Skip to content

Commit

Permalink
[DeadCode] Skip use docblock on BooleanAnd check on RemoveDeadInstanc…
Browse files Browse the repository at this point in the history
…eOfRector (#5751)

* [DeadCode] Skip use docblock on BooleanAnd check on RemoveDeadInstanceOfRector

* rename fixture

* Fix
  • Loading branch information
samsonasik committed Mar 21, 2024
1 parent 0dd1a43 commit aaf006c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
@@ -0,0 +1,18 @@
<?php

namespace Rector\Tests\DeadCode\Rector\If_\RemoveDeadInstanceOfRector\Fixture;

use PhpParser\Node;

final class SkipIncludeAndFromDocblock
{
/**
* @param Node $var
*/
public function go($var)
{
if ($var instanceof Node && $var->getLine() === 100) {
}
}
}

2 changes: 1 addition & 1 deletion rules/DeadCode/Rector/If_/RemoveDeadInstanceOfRector.php
Expand Up @@ -149,7 +149,7 @@ private function isInstanceofTheSameType(Instanceof_ $instanceof): ?bool
}

$classType = $this->nodeTypeResolver->getType($instanceof->class);
$exprType = $this->nodeTypeResolver->getType($instanceof->expr);
$exprType = $this->nodeTypeResolver->getNativeType($instanceof->expr);

if ($classType->equals($exprType)) {
return true;
Expand Down

0 comments on commit aaf006c

Please sign in to comment.