From 21ccea50b56747ecaad416a94460337c7918d93d Mon Sep 17 00:00:00 2001 From: Guillaume Chehami Date: Tue, 27 Jan 2026 12:12:01 +0100 Subject: [PATCH 1/2] ref#184 checking if class implements Symfony\Component\Form\FormTypeInterface instead of checking the classname to determinate if the class is a form --- src/Visitor/Php/Symfony/FormTrait.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Visitor/Php/Symfony/FormTrait.php b/src/Visitor/Php/Symfony/FormTrait.php index 0a8b4b0..1892287 100644 --- a/src/Visitor/Php/Symfony/FormTrait.php +++ b/src/Visitor/Php/Symfony/FormTrait.php @@ -23,9 +23,12 @@ trait FormTrait */ private function isFormType(Node $node): bool { - // only Traverse *Type + // Check if the class implements FormTypeInterface if ($node instanceof Stmt\Class_) { - $this->isFormType = 'Type' === substr($node->name, -4); + $this->isFormType = \in_array( + 'Symfony\Component\Form\FormTypeInterface', + array_map(fn ($interface) => $interface->toString(), $node->implements ?? []) + ); } return $this->isFormType; From 18ea04c785c597a2e5fd4173777f240fecbb2b42 Mon Sep 17 00:00:00 2001 From: Guillaume Chehami Date: Wed, 28 Jan 2026 09:09:16 +0100 Subject: [PATCH 2/2] fix phpstan Call to an undefined method PhpParser\ParserFactory::createForVersion() --- src/FileExtractor/PHPFileExtractor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FileExtractor/PHPFileExtractor.php b/src/FileExtractor/PHPFileExtractor.php index cb35178..798d8ec 100644 --- a/src/FileExtractor/PHPFileExtractor.php +++ b/src/FileExtractor/PHPFileExtractor.php @@ -33,7 +33,7 @@ final class PHPFileExtractor implements FileExtractor public function getSourceLocations(SplFileInfo $file, SourceCollection $collection): void { $path = $file->getRelativePath(); - $parser = (new ParserFactory())->createForVersion(PhpVersion::fromString('8.1')); + $parser = (new ParserFactory())->createForNewestSupportedVersion(); $traverser = new NodeTraverser(); foreach ($this->visitors as $v) { $v->init($collection, $file);