From 8a1813a095a9cb287827cbc2bd814db1a990620f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 20 Jun 2019 08:42:33 +0200 Subject: [PATCH] Revert "minor #32054 Prepare for PHP 7.4 preload (nicolas-grekas)" This reverts commit a0aa94114a7b0334f94eb53c7536c729c1be2fef, reversing changes made to 8496003634906d220ee1bc95f1547ced64545ffa. --- ...tyServiceSubscriberInterface.contracts.php | 21 ----- ...ilityServiceSubscriberInterface.legacy.php | 21 ----- ...ompatibilityServiceSubscriberInterface.php | 15 +++- ...tyServiceSubscriberInterface.contracts.php | 21 ----- ...ilityServiceSubscriberInterface.legacy.php | 21 ----- ...ompatibilityServiceSubscriberInterface.php | 15 +++- .../Cache/Exception/CacheException+psr16.php | 19 ----- .../Cache/Exception/CacheException-psr16.php | 18 ----- .../Cache/Exception/CacheException.php | 9 ++- .../InvalidArgumentException+psr16.php | 19 ----- .../InvalidArgumentException-psr16.php | 18 ----- .../Exception/InvalidArgumentException.php | 9 ++- .../Cache/Exception/LogicException+psr16.php | 19 ----- .../Cache/Exception/LogicException-psr16.php | 18 ----- .../Cache/Exception/LogicException.php | 11 ++- .../Contracts/EventDispatcher/Event+psr14.php | 54 ------------- .../Contracts/EventDispatcher/Event-psr14.php | 52 ------------ .../Contracts/EventDispatcher/Event.php | 80 ++++++++++++++++++- .../EventDispatcherInterface+psr14.php | 35 -------- .../EventDispatcherInterface-psr14.php | 33 -------- .../EventDispatcherInterface.php | 42 +++++++++- 21 files changed, 166 insertions(+), 384 deletions(-) delete mode 100644 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.contracts.php delete mode 100644 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.legacy.php delete mode 100644 src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.contracts.php delete mode 100644 src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.legacy.php delete mode 100644 src/Symfony/Component/Cache/Exception/CacheException+psr16.php delete mode 100644 src/Symfony/Component/Cache/Exception/CacheException-psr16.php delete mode 100644 src/Symfony/Component/Cache/Exception/InvalidArgumentException+psr16.php delete mode 100644 src/Symfony/Component/Cache/Exception/InvalidArgumentException-psr16.php delete mode 100644 src/Symfony/Component/Cache/Exception/LogicException+psr16.php delete mode 100644 src/Symfony/Component/Cache/Exception/LogicException-psr16.php delete mode 100644 src/Symfony/Contracts/EventDispatcher/Event+psr14.php delete mode 100644 src/Symfony/Contracts/EventDispatcher/Event-psr14.php delete mode 100644 src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface+psr14.php delete mode 100644 src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface-psr14.php diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.contracts.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.contracts.php deleted file mode 100644 index abe621908e..0000000000 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.contracts.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\FrameworkBundle\DependencyInjection; - -use Symfony\Contracts\Service\ServiceSubscriberInterface; - -/** - * @internal - */ -interface CompatibilityServiceSubscriberInterface extends ServiceSubscriberInterface -{ -} diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.legacy.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.legacy.php deleted file mode 100644 index af5dab3db5..0000000000 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.legacy.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\FrameworkBundle\DependencyInjection; - -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface as LegacyServiceSubscriberInterface; - -/** - * @internal - */ -interface CompatibilityServiceSubscriberInterface extends LegacyServiceSubscriberInterface -{ -} diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php index 4ed5bac6a6..41d4aa81e9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php @@ -12,9 +12,20 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ServiceSubscriberInterface as LegacyServiceSubscriberInterface; +use Symfony\Contracts\Service\ServiceSubscriberInterface; if (interface_exists(LegacyServiceSubscriberInterface::class)) { - require __DIR__.\DIRECTORY_SEPARATOR.'CompatibilityServiceSubscriberInterface.legacy.php'; + /** + * @internal + */ + interface CompatibilityServiceSubscriberInterface extends LegacyServiceSubscriberInterface + { + } } else { - require __DIR__.\DIRECTORY_SEPARATOR.'CompatibilityServiceSubscriberInterface.contracts.php'; + /** + * @internal + */ + interface CompatibilityServiceSubscriberInterface extends ServiceSubscriberInterface + { + } } diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.contracts.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.contracts.php deleted file mode 100644 index 4f30bf63a0..0000000000 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.contracts.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\TwigBundle\DependencyInjection; - -use Symfony\Contracts\Service\ServiceSubscriberInterface; - -/** - * @internal - */ -interface CompatibilityServiceSubscriberInterface extends ServiceSubscriberInterface -{ -} diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.legacy.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.legacy.php deleted file mode 100644 index 494e8f5c51..0000000000 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.legacy.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\TwigBundle\DependencyInjection; - -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface as LegacyServiceSubscriberInterface; - -/** - * @internal - */ -interface CompatibilityServiceSubscriberInterface extends LegacyServiceSubscriberInterface -{ -} diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php index 8afe2f61ef..967f732ff5 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php @@ -12,9 +12,20 @@ namespace Symfony\Bundle\TwigBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ServiceSubscriberInterface as LegacyServiceSubscriberInterface; +use Symfony\Contracts\Service\ServiceSubscriberInterface; if (interface_exists(LegacyServiceSubscriberInterface::class)) { - require __DIR__.\DIRECTORY_SEPARATOR.'CompatibilityServiceSubscriberInterface.legacy.php'; + /** + * @internal + */ + interface CompatibilityServiceSubscriberInterface extends LegacyServiceSubscriberInterface + { + } } else { - require __DIR__.\DIRECTORY_SEPARATOR.'CompatibilityServiceSubscriberInterface.contracts.php'; + /** + * @internal + */ + interface CompatibilityServiceSubscriberInterface extends ServiceSubscriberInterface + { + } } diff --git a/src/Symfony/Component/Cache/Exception/CacheException+psr16.php b/src/Symfony/Component/Cache/Exception/CacheException+psr16.php deleted file mode 100644 index e87b2db8fe..0000000000 --- a/src/Symfony/Component/Cache/Exception/CacheException+psr16.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Exception; - -use Psr\Cache\CacheException as Psr6CacheInterface; -use Psr\SimpleCache\CacheException as SimpleCacheInterface; - -class CacheException extends \Exception implements Psr6CacheInterface, SimpleCacheInterface -{ -} diff --git a/src/Symfony/Component/Cache/Exception/CacheException-psr16.php b/src/Symfony/Component/Cache/Exception/CacheException-psr16.php deleted file mode 100644 index 1dca75f16d..0000000000 --- a/src/Symfony/Component/Cache/Exception/CacheException-psr16.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Exception; - -use Psr\Cache\CacheException as Psr6CacheInterface; - -class CacheException extends \Exception implements Psr6CacheInterface -{ -} diff --git a/src/Symfony/Component/Cache/Exception/CacheException.php b/src/Symfony/Component/Cache/Exception/CacheException.php index c052a12c84..d2e975b2bc 100644 --- a/src/Symfony/Component/Cache/Exception/CacheException.php +++ b/src/Symfony/Component/Cache/Exception/CacheException.php @@ -11,10 +11,15 @@ namespace Symfony\Component\Cache\Exception; +use Psr\Cache\CacheException as Psr6CacheInterface; use Psr\SimpleCache\CacheException as SimpleCacheInterface; if (interface_exists(SimpleCacheInterface::class)) { - require __DIR__.\DIRECTORY_SEPARATOR.'CacheException+psr16.php'; + class CacheException extends \Exception implements Psr6CacheInterface, SimpleCacheInterface + { + } } else { - require __DIR__.\DIRECTORY_SEPARATOR.'CacheException-psr16.php'; + class CacheException extends \Exception implements Psr6CacheInterface + { + } } diff --git a/src/Symfony/Component/Cache/Exception/InvalidArgumentException+psr16.php b/src/Symfony/Component/Cache/Exception/InvalidArgumentException+psr16.php deleted file mode 100644 index 828bf3ed77..0000000000 --- a/src/Symfony/Component/Cache/Exception/InvalidArgumentException+psr16.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Exception; - -use Psr\Cache\InvalidArgumentException as Psr6CacheInterface; -use Psr\SimpleCache\InvalidArgumentException as SimpleCacheInterface; - -class InvalidArgumentException extends \InvalidArgumentException implements Psr6CacheInterface, SimpleCacheInterface -{ -} diff --git a/src/Symfony/Component/Cache/Exception/InvalidArgumentException-psr16.php b/src/Symfony/Component/Cache/Exception/InvalidArgumentException-psr16.php deleted file mode 100644 index 5a80c94dab..0000000000 --- a/src/Symfony/Component/Cache/Exception/InvalidArgumentException-psr16.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Exception; - -use Psr\Cache\InvalidArgumentException as Psr6CacheInterface; - -class InvalidArgumentException extends \InvalidArgumentException implements Psr6CacheInterface -{ -} diff --git a/src/Symfony/Component/Cache/Exception/InvalidArgumentException.php b/src/Symfony/Component/Cache/Exception/InvalidArgumentException.php index 2c891d7365..7f9584a264 100644 --- a/src/Symfony/Component/Cache/Exception/InvalidArgumentException.php +++ b/src/Symfony/Component/Cache/Exception/InvalidArgumentException.php @@ -11,10 +11,15 @@ namespace Symfony\Component\Cache\Exception; +use Psr\Cache\InvalidArgumentException as Psr6CacheInterface; use Psr\SimpleCache\InvalidArgumentException as SimpleCacheInterface; if (interface_exists(SimpleCacheInterface::class)) { - require __DIR__.\DIRECTORY_SEPARATOR.'InvalidArgumentException+psr16.php'; + class InvalidArgumentException extends \InvalidArgumentException implements Psr6CacheInterface, SimpleCacheInterface + { + } } else { - require __DIR__.\DIRECTORY_SEPARATOR.'InvalidArgumentException-psr16.php'; + class InvalidArgumentException extends \InvalidArgumentException implements Psr6CacheInterface + { + } } diff --git a/src/Symfony/Component/Cache/Exception/LogicException+psr16.php b/src/Symfony/Component/Cache/Exception/LogicException+psr16.php deleted file mode 100644 index d299673eb2..0000000000 --- a/src/Symfony/Component/Cache/Exception/LogicException+psr16.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Exception; - -use Psr\Cache\CacheException as Psr6CacheInterface; -use Psr\SimpleCache\CacheException as SimpleCacheInterface; - -class LogicException extends \LogicException implements Psr6CacheInterface, SimpleCacheInterface -{ -} diff --git a/src/Symfony/Component/Cache/Exception/LogicException-psr16.php b/src/Symfony/Component/Cache/Exception/LogicException-psr16.php deleted file mode 100644 index fc330ffaf9..0000000000 --- a/src/Symfony/Component/Cache/Exception/LogicException-psr16.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Exception; - -use Psr\Cache\CacheException as Psr6CacheInterface; - -class LogicException extends \LogicException implements Psr6CacheInterface -{ -} diff --git a/src/Symfony/Component/Cache/Exception/LogicException.php b/src/Symfony/Component/Cache/Exception/LogicException.php index 6dfdf2a40e..9ffa7ed695 100644 --- a/src/Symfony/Component/Cache/Exception/LogicException.php +++ b/src/Symfony/Component/Cache/Exception/LogicException.php @@ -11,10 +11,15 @@ namespace Symfony\Component\Cache\Exception; -use Psr\SimpleCache\LogicException as SimpleCacheInterface; +use Psr\Cache\CacheException as Psr6CacheInterface; +use Psr\SimpleCache\CacheException as SimpleCacheInterface; if (interface_exists(SimpleCacheInterface::class)) { - require __DIR__.\DIRECTORY_SEPARATOR.'LogicException+psr16.php'; + class LogicException extends \LogicException implements Psr6CacheInterface, SimpleCacheInterface + { + } } else { - require __DIR__.\DIRECTORY_SEPARATOR.'LogicException-psr16.php'; + class LogicException extends \LogicException implements Psr6CacheInterface + { + } } diff --git a/src/Symfony/Contracts/EventDispatcher/Event+psr14.php b/src/Symfony/Contracts/EventDispatcher/Event+psr14.php deleted file mode 100644 index 26ca47377a..0000000000 --- a/src/Symfony/Contracts/EventDispatcher/Event+psr14.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Contracts\EventDispatcher; - -use Psr\EventDispatcher\StoppableEventInterface; - -/** - * Event is the base class for classes containing event data. - * - * This class contains no event data. It is used by events that do not pass - * state information to an event handler when an event is raised. - * - * You can call the method stopPropagation() to abort the execution of - * further listeners in your event listener. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * @author Nicolas Grekas - */ -class Event implements StoppableEventInterface -{ - private $propagationStopped = false; - - /** - * Returns whether further event listeners should be triggered. - */ - public function isPropagationStopped(): bool - { - return $this->propagationStopped; - } - - /** - * Stops the propagation of the event to further event listeners. - * - * If multiple event listeners are connected to the same event, no - * further event listener will be triggered once any trigger calls - * stopPropagation(). - */ - public function stopPropagation(): void - { - $this->propagationStopped = true; - } -} diff --git a/src/Symfony/Contracts/EventDispatcher/Event-psr14.php b/src/Symfony/Contracts/EventDispatcher/Event-psr14.php deleted file mode 100644 index 7636c8bf17..0000000000 --- a/src/Symfony/Contracts/EventDispatcher/Event-psr14.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Contracts\EventDispatcher; - -/** - * Event is the base class for classes containing event data. - * - * This class contains no event data. It is used by events that do not pass - * state information to an event handler when an event is raised. - * - * You can call the method stopPropagation() to abort the execution of - * further listeners in your event listener. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * @author Nicolas Grekas - */ -class Event -{ - private $propagationStopped = false; - - /** - * Returns whether further event listeners should be triggered. - */ - public function isPropagationStopped(): bool - { - return $this->propagationStopped; - } - - /** - * Stops the propagation of the event to further event listeners. - * - * If multiple event listeners are connected to the same event, no - * further event listener will be triggered once any trigger calls - * stopPropagation(). - */ - public function stopPropagation(): void - { - $this->propagationStopped = true; - } -} diff --git a/src/Symfony/Contracts/EventDispatcher/Event.php b/src/Symfony/Contracts/EventDispatcher/Event.php index 3574fd44e9..84f60f3ed0 100644 --- a/src/Symfony/Contracts/EventDispatcher/Event.php +++ b/src/Symfony/Contracts/EventDispatcher/Event.php @@ -14,7 +14,83 @@ namespace Symfony\Contracts\EventDispatcher; use Psr\EventDispatcher\StoppableEventInterface; if (interface_exists(StoppableEventInterface::class)) { - require __DIR__.\DIRECTORY_SEPARATOR.'Event+psr14.php'; + /** + * Event is the base class for classes containing event data. + * + * This class contains no event data. It is used by events that do not pass + * state information to an event handler when an event is raised. + * + * You can call the method stopPropagation() to abort the execution of + * further listeners in your event listener. + * + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author Bernhard Schussek + * @author Nicolas Grekas + */ + class Event implements StoppableEventInterface + { + private $propagationStopped = false; + + /** + * Returns whether further event listeners should be triggered. + */ + public function isPropagationStopped(): bool + { + return $this->propagationStopped; + } + + /** + * Stops the propagation of the event to further event listeners. + * + * If multiple event listeners are connected to the same event, no + * further event listener will be triggered once any trigger calls + * stopPropagation(). + */ + public function stopPropagation(): void + { + $this->propagationStopped = true; + } + } } else { - require __DIR__.\DIRECTORY_SEPARATOR.'Event-psr14.php'; + /** + * Event is the base class for classes containing event data. + * + * This class contains no event data. It is used by events that do not pass + * state information to an event handler when an event is raised. + * + * You can call the method stopPropagation() to abort the execution of + * further listeners in your event listener. + * + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author Bernhard Schussek + * @author Nicolas Grekas + */ + class Event + { + private $propagationStopped = false; + + /** + * Returns whether further event listeners should be triggered. + */ + public function isPropagationStopped(): bool + { + return $this->propagationStopped; + } + + /** + * Stops the propagation of the event to further event listeners. + * + * If multiple event listeners are connected to the same event, no + * further event listener will be triggered once any trigger calls + * stopPropagation(). + */ + public function stopPropagation(): void + { + $this->propagationStopped = true; + } + } } diff --git a/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface+psr14.php b/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface+psr14.php deleted file mode 100644 index fcfa91c700..0000000000 --- a/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface+psr14.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Contracts\EventDispatcher; - -use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface; - -/** - * Allows providing hooks on domain-specific lifecycles by dispatching events. - */ -interface EventDispatcherInterface extends PsrEventDispatcherInterface -{ - /** - * Dispatches an event to all registered listeners. - * - * For BC with Symfony 4, the $eventName argument is not declared explicitly on the - * signature of the method. Implementations that are not bound by this BC constraint - * MUST declare it explicitly, as allowed by PHP. - * - * @param object $event The event to pass to the event handlers/listeners - * @param string|null $eventName The name of the event to dispatch. If not supplied, - * the class of $event should be used instead. - * - * @return object The passed $event MUST be returned - */ - public function dispatch($event/*, string $eventName = null*/); -} diff --git a/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface-psr14.php b/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface-psr14.php deleted file mode 100644 index a630339bdc..0000000000 --- a/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface-psr14.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Contracts\EventDispatcher; - -/** - * Allows providing hooks on domain-specific lifecycles by dispatching events. - */ -interface EventDispatcherInterface -{ - /** - * Dispatches an event to all registered listeners. - * - * For BC with Symfony 4, the $eventName argument is not declared explicitly on the - * signature of the method. Implementations that are not bound by this BC constraint - * MUST declare it explicitly, as allowed by PHP. - * - * @param object $event The event to pass to the event handlers/listeners - * @param string|null $eventName The name of the event to dispatch. If not supplied, - * the class of $event should be used instead. - * - * @return object The passed $event MUST be returned - */ - public function dispatch($event/*, string $eventName = null*/); -} diff --git a/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface.php b/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface.php index ef8be54b5a..2d470af920 100644 --- a/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface.php +++ b/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface.php @@ -14,7 +14,45 @@ namespace Symfony\Contracts\EventDispatcher; use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface; if (interface_exists(PsrEventDispatcherInterface::class)) { - require __DIR__.\DIRECTORY_SEPARATOR.'EventDispatcherInterface+psr14.php'; + /** + * Allows providing hooks on domain-specific lifecycles by dispatching events. + */ + interface EventDispatcherInterface extends PsrEventDispatcherInterface + { + /** + * Dispatches an event to all registered listeners. + * + * For BC with Symfony 4, the $eventName argument is not declared explicitly on the + * signature of the method. Implementations that are not bound by this BC constraint + * MUST declare it explicitly, as allowed by PHP. + * + * @param object $event The event to pass to the event handlers/listeners + * @param string|null $eventName The name of the event to dispatch. If not supplied, + * the class of $event should be used instead. + * + * @return object The passed $event MUST be returned + */ + public function dispatch($event/*, string $eventName = null*/); + } } else { - require __DIR__.\DIRECTORY_SEPARATOR.'EventDispatcherInterface-psr14.php'; + /** + * Allows providing hooks on domain-specific lifecycles by dispatching events. + */ + interface EventDispatcherInterface + { + /** + * Dispatches an event to all registered listeners. + * + * For BC with Symfony 4, the $eventName argument is not declared explicitly on the + * signature of the method. Implementations that are not bound by this BC constraint + * MUST declare it explicitly, as allowed by PHP. + * + * @param object $event The event to pass to the event handlers/listeners + * @param string|null $eventName The name of the event to dispatch. If not supplied, + * the class of $event should be used instead. + * + * @return object The passed $event MUST be returned + */ + public function dispatch($event/*, string $eventName = null*/); + } }