Skip to content

ExceptionEvent in signature but Event in doc block #1514

@gitomato

Description

@gitomato

I'm using Rector to migrate a project from Symfony 4.2 to 4.3. Thank you for this great tool.

Here is one strange result (I stripped down useless lines) :

    ---------- begin diff ----------
--- Original
+++ New
@@ -6,7 +6,7 @@
-use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
+use \Symfony\Component\HttpKernel\Event\ExceptionEvent;

 class ExceptionSubscriber implements EventSubscriberInterface
@@ -39,11 +39,11 @@
     }

     /**
-     * @param GetResponseForExceptionEvent $event
+     * @param \Symfony\Contracts\EventDispatcher\Event $event
      */
-    public function processException(GetResponseForExceptionEvent $event): void
+    public function processException(\Symfony\Component\HttpKernel\Event\ExceptionEvent $event): void
     {
         $this->logger->error($event->getException()->getMessage(), [
    ----------- end diff -----------

Applied rectors:

 * Rector\Rector\Class_\RenameClassRector

Rector suggests ExceptionEvent in method signature, but Event in doc block.
Then my IDE complains about PHPdoc not being in sync with method signature.

In my case ExceptionEvent is right, Event being too generic (I need $event->getException()).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions