diff --git a/src/Annotator/ClassAnnotatorTask/ModelAwareClassAnnotatorTask.php b/src/Annotator/ClassAnnotatorTask/ModelAwareClassAnnotatorTask.php index f2f48117..f76c2931 100644 --- a/src/Annotator/ClassAnnotatorTask/ModelAwareClassAnnotatorTask.php +++ b/src/Annotator/ClassAnnotatorTask/ModelAwareClassAnnotatorTask.php @@ -2,6 +2,7 @@ namespace IdeHelper\Annotator\ClassAnnotatorTask; +use ReflectionClass; use Throwable; /** @@ -24,13 +25,14 @@ public function shouldRun(string $path, string $content): bool { return true; } + /** @var class-string|null $className */ $className = $this->getClassName($path, $content); if (!$className) { return false; } - + try { - return (new \ReflectionClass($className))->hasMethod('loadModel'); + return (new ReflectionClass($className))->hasMethod('loadModel'); } catch (Throwable $exception) { return false; }