forked from EC-CUBE/ec-cube
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix `Calling the "Symfony\Component\EventDispatcher\EventDispatcherIn…
…terface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3`
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/* | ||
* This file is part of EC-CUBE | ||
* | ||
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. | ||
* | ||
* http://www.ec-cube.co.jp/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Eccube\Event; | ||
|
||
use Symfony\Component\EventDispatcher\Event; | ||
use Symfony\Component\EventDispatcher\EventDispatcher; | ||
|
||
class EventDispatcherWrapper extends EventDispatcher | ||
{ | ||
public function dispatch($event) | ||
{ | ||
$eventName = 1 < \func_num_args() ? func_get_arg(1) : null; | ||
|
||
if (\is_object($event)) { | ||
$eventName = $eventName ?? \get_class($event); | ||
} elseif (\is_string($event) && (null === $eventName || $eventName instanceof \Symfony\Contracts\EventDispatcher\Event || $eventName instanceof Event)) { | ||
$swap = $event; | ||
$event = $eventName ?? new Event(); | ||
$eventName = $swap; | ||
} | ||
|
||
return parent::dispatch($event, $eventName); | ||
} | ||
|
||
} |