Skip to content

Commit a738e4e

Browse files
authored
[DeadCode] Skip with first class callable on RemoveUnusedPrivateMethodParameterRector (#7104)
1 parent 17eb068 commit a738e4e

3 files changed

Lines changed: 16 additions & 39 deletions

File tree

rules-tests/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodParameterRector/Fixture/do_not_remove_first_class_callable_param.php.inc

Lines changed: 0 additions & 35 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodParameterRector\Fixture;
4+
5+
final class SkipWithFirstClassCallable
6+
{
7+
public function run()
8+
{
9+
return $this->validate(...);
10+
}
11+
12+
private function validate(string $attribute, mixed $value): bool
13+
{
14+
return $value === true;
15+
}
16+
}

rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodParameterRector.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,6 @@ private function resolveCallers(ClassMethod $classMethod, string $methodName, Ob
199199
return false;
200200
}
201201

202-
if ($subNode->isFirstClassCallable()) {
203-
return false;
204-
}
205-
206202
$nodeToCheck = $subNode instanceof MethodCall
207203
? $subNode->var
208204
: $subNode->class;

0 commit comments

Comments
 (0)