laravel-workflow
laravel-workflow copied to clipboard
Since symfony/workflow 6.4: The Symfony\Component\Workflow\Event\GuardEvent::getContext() method is deprecated and will be removed in 7.0
Version : 4.2.0
I get this deprecate error while using the last version of the package:
Since symfony/workflow 6.4: The Symfony\Component\Workflow\Event\GuardEvent::getContext() method is deprecated and will be removed in 7.0. You should no longer call this method as it always returns an empty array when invoked within a guard listener. in /vendor/symfony/deprecation-contracts/function.php on line 25
How can I prevent it please?
Looks like we're going to need to do some work to support Symfony 7 (and clear up these warnings in the meantime). A quick glance at the code suggests the issue is in the helper methods in (de)serialization, here.
Seems like the best/easiest route right now is to make the BaseEvent
class context-less (i.e. don't call ->getContext()
on the base event) and then either with a trait or intermediate class, reintroduce that to the non-guard events.
We should definitely look through the rest of the Symfony 7 changes to see what else is special with guard listener events. It may be worth splitting those off entirely.
PRs are greatly appreciated here! I don't expect to be able to find the time to take care of this in the near future (I'm not really using PHP nowadays anymore either).
Fixed with v5: https://github.com/zerodahero/laravel-workflow/releases/tag/v5.0.0