laminas / laminas-form

Validate and display simple and complex forms, casting forms to business objects and vice versa
https://docs.laminas.dev/laminas-form/
BSD 3-Clause "New" or "Revised" License
80 stars 52 forks source link

Loosen `checkForExclude` callback parameter type declaration #276

Closed JoshuaLicense closed 2 months ago

JoshuaLicense commented 2 months ago
Q A
Bugfix yes

Description

Loosens the type declaration from bool -> ?bool in checkForExclude callback.

Reproduction: Attach an event that returns void that listens for the checkForExclude (or *) event.

Using laminas-developer-tools with the default setup (listening for all events) will have a listener that returns void (\Laminas\DeveloperTools\Listener\EventLoggingListenerAggregate::onCollectEvent). The void is passed as a parameter to the callback (as null) and causes a TypeError.

Expected: To execute with listeners that return void.

Actual:

TypeError: Laminas\Form\Annotation\AbstractBuilder::Laminas\Form\Annotation\{closure}(): Argument #1 ($r) must be of type bool, null given, called in `vendor/laminas/laminas-eventmanager/src/EventManager.php` on line 330 `src/Annotation/AbstractBuilder.php:313`