8000 Move interface to symfony contract · symfony/symfony@d24ac02 · GitHub
[go: up one dir, main page]

Skip to content

Commit d24ac02

Browse files
committed
Move interface to symfony contract
1 parent 32177a8 commit d24ac02

File tree

5 files changed

+30
-43
lines changed

5 files changed

+30
-43
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
use Symfony\Component\DependencyInjection\Parameter;
5454
use Symfony\Component\DependencyInjection\Reference;
5555
use Symfony\Component\DependencyInjection\ServiceLocator;
56-
use Symfony\Component\EventDispatcher\EventListenerInterface;
5756
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
5857
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
5958
use Symfony\Component\Finder\Finder;
@@ -118,6 +117,7 @@
118117
use Symfony\Component\Yaml\Command\LintCommand as BaseYamlLintCommand;
119118
use Symfony\Component\Yaml\Yaml;
120119
use Symfony\Contracts\Cache\CacheInterface;
120+
use Symfony\Contracts\EventDispatcher\EventListenerInterface;
121121
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
122122
use Symfony\Contracts\HttpClient\HttpClientInterface;
123123
use Symfony\Contracts\Service\ResetInterface;

src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1919
use Symfony\Component\DependencyInjection\Reference;
2020
use Symfony\Component\EventDispatcher\EventDispatcher;
21-
use Symfony\Component\EventDispatcher\EventListenerInterface;
2221
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
22+
use Symfony\Contracts\EventDispatcher\EventListenerInterface;
2323

2424
/**
2525
* Compiler pass to register tagged services for an event dispatcher.
@@ -90,7 +90,7 @@ public function process(ContainerBuilder $container)
9090
$event['method'] = 'on'.preg_replace_callback([
9191
'/(?<=\b)[a-z]/i',
9292
'/[^a-z0-9]/i',
93-
], function ($matches) { return strtoupper($matches[0]); }, (false === $p = \strrpos($event['event'], '\\')) ? $event['event'] : \substr($event['event'], $p + 1));
93+
], function ($matches) { return strtoupper($matches[0]); }, (false === $p = strrpos($event['event'], '\\')) ? $event['event'] : substr($event['event'], $p + 1));
9494
$event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']);
9595

9696
if (null === $reflection) {

src/Symfony/Component/EventDispatcher/EventListenerInterface.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717
use Symfony\Component\DependencyInjection\Reference;
1818
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
19-
use Symfony\Component\EventDispatcher\EventListenerInterface;
2019
use Symfony\Component\HttpKernel\Event\KernelEvent;
20+
use Symfony\Contracts\EventDispatcher\EventListenerInterface;
2121

2222
class RegisterListenersPassTest extends TestCase
2323
{
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Contracts\EventDispatcher;
13+
14+
/**
15+
* Marker interface for event listeners.
16+
*
17+
* @author Jérémy Derussé <jeremy@derusse.com>
18+
*
19+
* The `__invoke` method is required and the `$event` argument have to be Type-Hinted with the listened event's class
20+
* in order to be auto-configured.
21+
*
22+
* @method void __invoke(Object $event, string $eventName, EventDispatcherInterface $dispatcher)
23+
*/
24+
interface EventListenerInterface
25+
{
26+
}

0 commit comments

Comments
 (0)
0