Skip to content

Commit

Permalink
Do not use deprecated getClass() (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanmai committed Sep 7, 2020
1 parent f52ab19 commit b28f2e2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Event/EventDispatcher/SyncEventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
use Infection\Event\Subscriber\EventSubscriber;
use ReflectionClass;
use ReflectionMethod;
use ReflectionNamedType;
use Webmozart\Assert\Assert;

/**
Expand Down Expand Up @@ -82,14 +83,14 @@ private function inferSubscribedEvents(EventSubscriber $eventSubscriber): iterab
}

foreach ($method->getParameters() as $param) {
$paramClass = $param->getClass();
Assert::notNull($paramClass);
$paramClass = $param->getType();
Assert::isInstanceOf($paramClass, ReflectionNamedType::class);

$closure = $method->getClosure($eventSubscriber);
Assert::notNull($closure);

// Returning a closure instead of array [$eventSubscriber, $method->name], should work the same
yield $paramClass->name => $closure;
yield $paramClass->getName() => $closure;

break;
}
Expand Down

0 comments on commit b28f2e2

Please sign in to comment.