Skip to content

Commit

Permalink
fix: php8 Compilation failed: unrecognized character
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed May 1, 2021
1 parent b033a52 commit 0719114
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Aop.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use function count;
use function explode;
use function preg_match;
use function preg_quote;
use function strpos;

/**
* Class AopRegister
Expand Down Expand Up @@ -161,6 +163,12 @@ private static function isExecution(string $class, string $method, array $execut
// Class
[$executionClass, $executionMethod] = $executionAry;

// fix: php8 Compilation failed: unrecognized character follows \
if (strpos($executionClass, '\\\\') === false) {
// convert 'SwoftTest\Component\Testing\Aop\ZeroAop' to 'SwoftTest\\Component\\Testing\\Aop\\ZeroAop'
$executionClass = preg_quote($executionClass);
}

// Class reg
$classReg = '/' . $executionClass . '/';

Expand Down

0 comments on commit 0719114

Please sign in to comment.