Skip to content

Commit

Permalink
Handle AnnotationException in Gedmo\PropertiesExtension
Browse files Browse the repository at this point in the history
Suppresses the "The annotation X was never imported." exceptions  in case the `objectManagerLoader` is not configured.
  • Loading branch information
luxemate authored Oct 27, 2023
1 parent cba50e9 commit 6c3ee60
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Rules/Gedmo/PropertiesExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ private function isGedmoAnnotationOrAttribute(PropertyReflection $property, stri
return false;
}

$annotations = $this->annotationReader->getPropertyAnnotations($propertyReflection);
try {
$annotations = $this->annotationReader->getPropertyAnnotations($propertyReflection);
} catch (AnnotationException) {

Check failure on line 95 in src/Rules/Gedmo/PropertiesExtension.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0)

Caught class PHPStan\Rules\Gedmo\AnnotationException not found.

Check failure on line 95 in src/Rules/Gedmo/PropertiesExtension.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Caught class PHPStan\Rules\Gedmo\AnnotationException not found.

Check failure on line 95 in src/Rules/Gedmo/PropertiesExtension.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2)

Caught class PHPStan\Rules\Gedmo\AnnotationException not found.
// Suppress the "The annotation X was never imported." exception in case the `objectManagerLoader` is not configured
return false;
}

foreach ($annotations as $annotation) {
if (in_array(get_class($annotation), $classList, true)) {
return true;
Expand Down

0 comments on commit 6c3ee60

Please sign in to comment.