rockettheme / toolbox

RocketTheme\Toolbox package contains a set of reusable PHP interfaces, classes and traits.
MIT License
21 stars 16 forks source link

Declaration of EventDispatcher:dispatch not compatible with Symfony 5 #32

Open lcharette opened 2 years ago

lcharette commented 2 years ago

Latest version release add Symfony 5 in composer.json : https://github.com/rockettheme/toolbox/compare/1.6.0...1.6.1#diff-d2ab9925cad7eac58e0ff4cc0d251a937ecf49e4b6bf57f8b95aab76648a9d34R13

First, this a breaking change as it can cause unwanted dependencies change in some cases, and should have done in a new major version.

That being said, EventDispatcher doesn’t seams to be compatible with latest Symfony version :

PHP Fatal error:  Declaration of RocketTheme\Toolbox\Event\EventDispatcher::dispatch($eventName, ?Symfony\Component\EventDispatcher\Event $event = null) must be compatible with Symfony\Component\EventDispatcher\EventDispatcher::dispatch(obj
ect $event, ?string $eventName = null): object in <SNIP>\UserFrosting-4.6.3\app\vendor\rockettheme\toolbox\Event\src\EventDispatcher.php on line 23

Fatal error: Declaration of RocketTheme\Toolbox\Event\EventDispatcher::dispatch($eventName, ?Symfony\Component\EventDispatcher\Event $event = null) must be compatible with Symfony\Component\EventDispatcher\EventDispatcher::dispatch(object $
event, ?string $eventName = null): object in <SNIP>\UserFrosting-4.6.3\app\vendor\rockettheme\toolbox\Event\src\EventDispatcher.php on line 23

(Ref: https://github.com/userfrosting/UserFrosting/issues/1195)

mahagr commented 2 years ago

You're right, I should have updated only YAML.

That said, you should stop using Event Dispatcher in Toolbox as I have already removed it for the upcoming 2.0 release.

lcharette commented 2 years ago

Good to know. I already removed it in my next major version.

mahagr commented 2 years ago

You can test by playing with the dev version (more testing cannot hurt):

composer.json:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/rockettheme/toolbox"
        }
    ]
}