Skip to content

Commit 5e655f4

Browse files
authored
[DeadCode] Skip value from docblock on RemoveFilterVarOnExactTypeRector (#6873)
1 parent 91d644b commit 5e655f4

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

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\FuncCall\RemoveFilterVarOnExactTypeRector\Fixture;
4+
5+
final class SkipFromDocblock
6+
{
7+
/**
8+
* @param int $value
9+
*/
10+
public function run($value): false|int
11+
{
12+
return filter_var($value, FILTER_VALIDATE_INT);
13+
}
14+
}

rules/DeadCode/Rector/FuncCall/RemoveFilterVarOnExactTypeRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function refactor(Node $node): ?Node
7272

7373
$constantFilterName = $secondArgValue->name->toString();
7474

75-
$valueType = $this->getType($firstArgValue);
75+
$valueType = $this->nodeTypeResolver->getNativeType($firstArgValue);
7676

7777
if ($constantFilterName === 'FILTER_VALIDATE_INT' && $valueType->isInteger()->yes()) {
7878
return $firstArgValue;

0 commit comments

Comments
 (0)