Fixed Contributte events namespaces and added missing

This commit is contained in:
Jan Mikeš 2019-02-09 01:39:11 +01:00 committed by Tomas Votruba
parent a486f7fdbb
commit 678905bba2
2 changed files with 52 additions and 11 deletions

View File

@ -40,29 +40,70 @@ final class RenameEventNamesInEventSubscriberRector extends AbstractRector
* @var string[][]
*/
private $netteClassConstToSymfonyClassConstMap = [
'Contributte\Events\Extra\Event\Application::NAME' => ['Symfony\Component\HttpKernel\KernelEvents', 'REQUEST'],
'Contributte\Events\Extra\Event\ShutdownEvent::NAME' => [
'Contributte\Events\Extra\Event\Application\StartupEvent::NAME' => [
'Symfony\Component\HttpKernel\KernelEvents',
'REQUEST',
],
'Contributte\Events\Extra\Event\Application\PresenterShutdownEvent::NAME' => [
'Symfony\Component\HttpKernel\KernelEvents',
'TERMINATE',
],
'Contributte\Events\Extra\Event\RequestEvent::NAME' => ['Symfony\Component\HttpKernel\KernelEvents', 'REQUEST'],
'Contributte\Events\Extra\Event\PresenterEvent::NAME' => [
'Contributte\Events\Extra\Event\Application\RequestEvent::NAME' => [
'Symfony\Component\HttpKernel\KernelEvents',
'REQUEST',
],
'Contributte\Events\Extra\Event\Application\PresenterEvent::NAME' => [
'Symfony\Component\HttpKernel\KernelEvents',
'CONTROLLER',
],
'Contributte\Events\Extra\Event\PresenterStartupEvent::NAME' => [
'Contributte\Events\Extra\Event\Application\PresenterStartupEvent::NAME' => [
'Symfony\Component\HttpKernel\KernelEvents',
'CONTROLLER',
],
'Contributte\Events\Extra\Event\PresenterShutdownEvent::NAME' => [
'Contributte\Events\Extra\Event\Application\PresenterShutdownEvent::NAME' => [
'Symfony\Component\HttpKernel\KernelEvents',
'CONTROLLER',
],
'Contributte\Events\Extra\Event\ResponseEvent::NAME' => [
'Contributte\Events\Extra\Event\Application\ResponseEvent::NAME' => [
'Symfony\Component\HttpKernel\KernelEvents',
'RESPONSE',
],
'Contributte\Events\Extra\Event\ErrorEvent::NAME' => ['Symfony\Component\HttpKernel\KernelEvents', 'EXCEPTION'],
'Contributte\Events\Extra\Event\Application\ErrorEvent::NAME' => [
'Symfony\Component\HttpKernel\KernelEvents',
'EXCEPTION',
],
'Contributte\Events\Extra\Event\Application\ApplicationEvents::ON_STARTUP' => [
'Symfony\Component\HttpKernel\KernelEvents',
'REQUEST',
],
'Contributte\Events\Extra\Event\Application\ApplicationEvents::ON_SHUTDOWN' => [
'Symfony\Component\HttpKernel\KernelEvents',
'TERMINATE',
],
'Contributte\Events\Extra\Event\Application\ApplicationEvents::ON_REQUEST' => [
'Symfony\Component\HttpKernel\KernelEvents',
'REQUEST',
],
'Contributte\Events\Extra\Event\Application\ApplicationEvents::ON_PRESENTER' => [
'Symfony\Component\HttpKernel\KernelEvents',
'CONTROLLER',
],
'Contributte\Events\Extra\Event\Application\ApplicationEvents::ON_PRESENTER_STARTUP' => [
'Symfony\Component\HttpKernel\KernelEvents',
'CONTROLLER',
],
'Contributte\Events\Extra\Event\Application\ApplicationEvents::ON_PRESENTER_SHUTDOWN' => [
'Symfony\Component\HttpKernel\KernelEvents',
'CONTROLLER',
],
'Contributte\Events\Extra\Event\Application\ApplicationEvents::ON_RESPONSE' => [
'Symfony\Component\HttpKernel\KernelEvents',
'RESPONSE',
],
'Contributte\Events\Extra\Event\Application\ApplicationEvents::ON_ERROR' => [
'Symfony\Component\HttpKernel\KernelEvents',
'EXCEPTION',
],
];
/**

View File

@ -3,7 +3,7 @@
namespace Rector\NetteToSymfony\Tests\Rector\ClassMethod\RenameEventNamesInEventSubscriberRector\Fixture;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Contributte\Events\Extra\Event\PresenterStartupEvent;
use Contributte\Events\Extra\Event\Application\PresenterStartupEvent;
final class SomeClass implements EventSubscriberInterface
{
@ -11,7 +11,7 @@ final class SomeClass implements EventSubscriberInterface
{
return [
'nette.application.startup' => 'someMethod',
\Contributte\Events\Extra\Event\Application::NAME => 'someMethod',
\Contributte\Events\Extra\Event\Application\StartupEvent::NAME => 'someMethod',
PresenterStartupEvent::NAME => 'someMethod',
];
}
@ -24,7 +24,7 @@ final class SomeClass implements EventSubscriberInterface
namespace Rector\NetteToSymfony\Tests\Rector\ClassMethod\RenameEventNamesInEventSubscriberRector\Fixture;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Contributte\Events\Extra\Event\PresenterStartupEvent;
use Contributte\Events\Extra\Event\Application\PresenterStartupEvent;
final class SomeClass implements EventSubscriberInterface
{