Skip to content

Commit 6e24025

Browse files
committed
[ci-review] Rector Rectify
1 parent e28c15b commit 6e24025

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

rules/Php85/Rector/FuncCall/RemoveFinfoBufferContextArgRector.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function refactor(Node $node): ?Node
6363
return null;
6464
}
6565

66-
if ($node instanceof FuncCall && ! $this->isName($node->name, 'finfo_buffer')) {
66+
if (! $this->isName($node->name, 'finfo_buffer')) {
6767
return null;
6868
}
6969

@@ -88,44 +88,44 @@ public function provideMinPhpVersion(): int
8888
}
8989

9090
/**
91-
* @param FuncCall|MethodCall $funcCall
91+
* @param FuncCall|MethodCall $callLike
9292
*/
93-
private function removeContextArg(CallLike $funcCall): bool
93+
private function removeContextArg(CallLike $callLike): bool
9494
{
9595
// In `finfo::buffer` method calls, the first parameter, compared to `finfo_buffer`, does not exist.
9696
$methodArgCorrection = 0;
97-
if ($funcCall instanceof MethodCall) {
97+
if ($callLike instanceof MethodCall) {
9898
$methodArgCorrection = -1;
9999
}
100100

101-
if (count($funcCall->args) <= 2 + $methodArgCorrection) {
101+
if (count($callLike->args) <= 2 + $methodArgCorrection) {
102102
return false;
103103
}
104104

105105
// Cannot handle variadic args
106-
foreach ($funcCall->args as $position => $arg) {
106+
foreach ($callLike->args as $position => $arg) {
107107
if (! $arg instanceof Arg) {
108108
return false;
109109
}
110110
}
111111

112112
/** @var array<Arg> $args */
113-
$args = $funcCall->args;
113+
$args = $callLike->args;
114114

115115
// Argument 3 ($flags) and argument 4 ($context) are optional, thus named parameters must be considered
116116
if (! $this->argsAnalyzer->hasNamedArg($args)) {
117117
if (count($args) < 4 + $methodArgCorrection) {
118118
return false;
119119
}
120120

121-
unset($funcCall->args[3 + $methodArgCorrection]);
121+
unset($callLike->args[3 + $methodArgCorrection]);
122122

123123
return true;
124124
}
125125

126126
foreach ($args as $position => $arg) {
127127
if ($arg->name instanceof Identifier && $arg->name->name === 'context') {
128-
unset($funcCall->args[$position]);
128+
unset($callLike->args[$position]);
129129

130130
return true;
131131
}

0 commit comments

Comments
 (0)