From b7774acbd77b115ebd824b58156eff81edfe5fad Mon Sep 17 00:00:00 2001 From: JoshuaLicense Date: Wed, 21 Aug 2024 22:14:29 +0100 Subject: [PATCH] Loosen checkForExclude callback parameter type declaration Signed-off-by: JoshuaLicense --- src/Annotation/AbstractBuilder.php | 2 +- test/Annotation/AbstractBuilderTestCase.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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); + } }