Skip to content

Commit 6eac87d

Browse files
authored
Ignore phpdoc type in RecastingRemovalRector (#5841)
1 parent 71c6dd9 commit 6eac87d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Rector\Tests\DeadCode\Rector\Cast\RecastingRemovalRector\Fixture;
4+
5+
class SkipPhpDocTyped
6+
{
7+
/** @param array{key: int} $arr */
8+
public function run($arr = [])
9+
{
10+
echo "hello ". (int) $arr['key'];
11+
}
12+
}
13+
14+
?>

rules/DeadCode/Rector/Cast/RecastingRemovalRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function refactor(Node $node): ?Node
9696
return null;
9797
}
9898

99-
$nodeType = $this->getType($node->expr);
99+
$nodeType = $this->nodeTypeResolver->getNativeType($node->expr);
100100
if ($nodeType instanceof MixedType) {
101101
return null;
102102
}

0 commit comments

Comments
 (0)