Skip to content

Commit

Permalink
Ignore phpdoc type in RecastingRemovalRector (#5841)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Apr 22, 2024
1 parent 71c6dd9 commit 6eac87d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Rector\Tests\DeadCode\Rector\Cast\RecastingRemovalRector\Fixture;

class SkipPhpDocTyped
{
/** @param array{key: int} $arr */
public function run($arr = [])
{
echo "hello ". (int) $arr['key'];
}
}

?>
2 changes: 1 addition & 1 deletion rules/DeadCode/Rector/Cast/RecastingRemovalRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function refactor(Node $node): ?Node
return null;
}

$nodeType = $this->getType($node->expr);
$nodeType = $this->nodeTypeResolver->getNativeType($node->expr);
if ($nodeType instanceof MixedType) {
return null;
}
Expand Down

0 comments on commit 6eac87d

Please sign in to comment.