diff --git a/src/Annotation/AbstractBuilder.php b/src/Annotation/AbstractBuilder.php index 5000c16d..47f2e2f0 100644 --- a/src/Annotation/AbstractBuilder.php +++ b/src/Annotation/AbstractBuilder.php @@ -310,7 +310,7 @@ protected function checkForExclude(AnnotationCollection $annotations): bool // @codingStandardsIgnoreStart $results = $this->getEventManager()->triggerEventUntil( - static fn(bool $r): bool => true === $r, + static fn(?bool $r): bool => true === $r, $event ); // @codingStandardsIgnoreEnd diff --git a/test/Annotation/AbstractBuilderTestCase.php b/test/Annotation/AbstractBuilderTestCase.php index 1a3ee43b..cc9fd8ec 100644 --- a/test/Annotation/AbstractBuilderTestCase.php +++ b/test/Annotation/AbstractBuilderTestCase.php @@ -30,6 +30,7 @@ use LaminasTest\Form\TestAsset\Annotation\Form; use LaminasTest\Form\TestAsset\Annotation\InputFilter; use LaminasTest\Form\TestAsset\Annotation\InputFilterInput; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\Attributes\WithoutErrorHandler; use PHPUnit\Framework\TestCase; use Throwable; @@ -573,4 +574,17 @@ public function testLegacyStyleValidatorAnnotations(): void ErrorHandler::restoreErrorHandler(); } } + + #[DoesNotPerformAssertions] + public function testAllowsEventListenerReturnVoid(): void + { + $entity = new TestAsset\Annotation\Entity(); + $builder = $this->createBuilder(); + + $builder->getEventManager()->attach('*', function () { + // return void; + }); + + $builder->createForm($entity); + } }