Skip to content

Commit

Permalink
change is_a in ThrowWithPreviousExceptionRector
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Mar 19, 2021
1 parent ed79bce commit 10cd42f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use PhpParser\Node\Stmt\Throw_;
use PhpParser\NodeTraverser;
use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Type\ObjectType;
use PHPStan\Type\TypeWithClassName;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\MethodName;
Expand Down Expand Up @@ -186,7 +187,8 @@ private function resolveExceptionArgumentPosition(Name $exceptionName): ?int
continue;
}

if (! is_a($parameterType->getClassName(), Throwable::class, true)) {
$objectType = new ObjectType('Throwable');
if ($objectType->isSuperTypeOf($parameterType)->no()) {
continue;
}

Expand Down

0 comments on commit 10cd42f

Please sign in to comment.