diff --git a/src/Visitor/Php/Symfony/ValidationAnnotation.php b/src/Visitor/Php/Symfony/ValidationAnnotation.php index 05c86f8..d4181dd 100644 --- a/src/Visitor/Php/Symfony/ValidationAnnotation.php +++ b/src/Visitor/Php/Symfony/ValidationAnnotation.php @@ -11,9 +11,9 @@ namespace Translation\Extractor\Visitor\Php\Symfony; -use Doctrine\Common\Annotations\AnnotationException; use PhpParser\Node; use PhpParser\NodeVisitor; +use Symfony\Component\Validator\Exception\NoSuchMetadataException; use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; use Translation\Extractor\Visitor\Php\BasePHPVisitor; @@ -63,7 +63,7 @@ public function enterNode(Node $node): ?Node try { /** @var ClassMetadata $metadata */ $metadata = $this->metadataFactory->getMetadataFor($name); - } catch (AnnotationException $e) { + } catch (NoSuchMetadataException $e) { $this->addError($node, sprintf('Could not parse class "%s" for annotations. %s', $this->namespace, $e->getMessage())); return null;