diff --git a/bin/compiler.php b/bin/compiler.php index 9c9c3b17..52c7580d 100755 --- a/bin/compiler.php +++ b/bin/compiler.php @@ -2,10 +2,10 @@ redoAfterDeclare[$name])) { unset($this->redoAfterDeclare[$name]); $this->climate->cyan('Received redo request, retrying...'); - throw new RedoException(); + throw new Redo(); } } @@ -675,7 +676,7 @@ class CompilerBase extends \PhpAot\Core\Translator $this->indentLevel++; try { $stmts = $this->parseStmts($v->stmts); - } catch (SkipException $e) { + } catch (Skip $e) { $stmts = ''; } $this->indentLevel--; @@ -1254,7 +1255,7 @@ class CompilerBase extends \PhpAot\Core\Translator $this->functionDef->returnType = $type; // 返回值变更,需要重新解析 $this->climate->cyan('Return type changed, retrying...'); - throw new RedoException(); + throw new Redo(); } protected function detectVarType($var): string @@ -1741,7 +1742,7 @@ class CompilerBase extends \PhpAot\Core\Translator and $this->functionDeclInFile[$name] === $this->file and !$this->isNativeFunction($name)) { $this->redoAfterDeclare[$name] = true; - throw new SkipException(); + throw new Skip(); } if ($this->isNativeFunction($name)) { return $name; diff --git a/src/Php/RedoException.php b/src/Php/Exception/Redo.php similarity index 66% rename from src/Php/RedoException.php rename to src/Php/Exception/Redo.php index a978c969..422f7a11 100644 --- a/src/Php/RedoException.php +++ b/src/Php/Exception/Redo.php @@ -6,8 +6,8 @@ * @contact service@swoole.com */ -namespace PhpAot\Php; +namespace PhpAot\Php\Exception; -class RedoException extends \RuntimeException +class Redo extends \RuntimeException { } diff --git a/src/Php/Exception/Skip.php b/src/Php/Exception/Skip.php new file mode 100644 index 00000000..40077f38 --- /dev/null +++ b/src/Php/Exception/Skip.php @@ -0,0 +1,8 @@ +phpSrcFiles[] = $file; return $cppFile; - } catch (RedoException $e) { + } catch (Redo $e) { continue; } } diff --git a/src/functions.php b/src/functions.php index e43c6a00..7d2f371d 100644 --- a/src/functions.php +++ b/src/functions.php @@ -1,7 +1,7 @@