Skip to content

Commit bc4cdce

Browse files
Revert old fix
1 parent a5cece4 commit bc4cdce

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

‎src/Rules/FunctionCallParametersCheck.php‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,6 @@ public function check(
8989
string $namedArgumentMessage,
9090
): array
9191
{
92-
if ($funcCall instanceof Node\Expr\MethodCall || $funcCall instanceof Node\Expr\StaticCall || $funcCall instanceof Node\Expr\FuncCall) {
93-
$funcCallLine = $funcCall->name->getStartLine();
94-
} else {
95-
$funcCallLine = $funcCall->getStartLine();
96-
}
97-
9892
$functionParametersMinCount = 0;
9993
$functionParametersMaxCount = 0;
10094
foreach ($parametersAcceptor->getParameters() as $parameter) {
@@ -231,7 +225,6 @@ public function check(
231225
if ($hasNamedArguments && !$scope->getPhpVersion()->supportsNamedArguments()->yes() && !(bool) $funcCall->getAttribute('isAttribute', false)) {
232226
$errors[] = RuleErrorBuilder::message('Named arguments are supported only on PHP 8.0 and later.')
233227
->identifier('argument.namedNotSupported')
234-
->line($funcCallLine)
235228
->nonIgnorable()
236229
->build();
237230
}
@@ -256,7 +249,6 @@ public function check(
256249
$functionParametersMinCount,
257250
))
258251
->identifier('arguments.count')
259-
->line($funcCallLine)
260252
->build();
261253
} elseif ($functionParametersMaxCount === -1 && $invokedParametersCount < $functionParametersMinCount) {
262254
$errors[] = RuleErrorBuilder::message(sprintf(
@@ -265,7 +257,6 @@ public function check(
265257
$functionParametersMinCount,
266258
))
267259
->identifier('arguments.count')
268-
->line($funcCallLine)
269260
->build();
270261
} elseif ($functionParametersMaxCount !== -1) {
271262
$errors[] = RuleErrorBuilder::message(sprintf(
@@ -275,7 +266,6 @@ public function check(
275266
$functionParametersMaxCount,
276267
))
277268
->identifier('arguments.count')
278-
->line($funcCallLine)
279269
->build();
280270
}
281271
}
@@ -288,11 +278,10 @@ public function check(
288278
) {
289279
$errors[] = RuleErrorBuilder::message($voidReturnTypeUsed)
290280
->identifier(sprintf('%s.void', $nodeType))
291-
->line($funcCallLine)
292281
->build();
293282
}
294283

295-
[$addedErrors, $argumentsWithParameters] = $this->processArguments($parametersAcceptor, $funcCallLine, $isBuiltin, $arguments, $hasNamedArguments, $missingParameterMessage, $unknownParameterMessage);
284+
[$addedErrors, $argumentsWithParameters] = $this->processArguments($parametersAcceptor, $isBuiltin, $arguments, $hasNamedArguments, $missingParameterMessage, $unknownParameterMessage);
296285
foreach ($addedErrors as $error) {
297286
$errors[] = $error;
298287
}
@@ -534,7 +523,6 @@ static function (Type $type, callable $traverse) use (&$returnTemplateTypes): Ty
534523

535524
$errors[] = RuleErrorBuilder::message(sprintf($unresolvableTemplateTypeMessage, $name))
536525
->identifier('argument.templateType')
537-
->line($funcCallLine)
538526
->tip('See: https://phpstan.org/blog/solving-phpstan-error-unable-to-resolve-template-type')
539527
->build();
540528
}
@@ -546,7 +534,6 @@ static function (Type $type, callable $traverse) use (&$returnTemplateTypes): Ty
546534
) {
547535
$errors[] = RuleErrorBuilder::message($unresolvableReturnTypeMessage)
548536
->identifier(sprintf('%s.unresolvableReturnType', $nodeType))
549-
->line($funcCallLine)
550537
->build();
551538
}
552539
}
@@ -560,7 +547,6 @@ static function (Type $type, callable $traverse) use (&$returnTemplateTypes): Ty
560547
*/
561548
private function processArguments(
562549
ParametersAcceptor $parametersAcceptor,
563-
int $line,
564550
bool $isBuiltin,
565551
array $arguments,
566552
bool $hasNamedArguments,
@@ -675,7 +661,6 @@ private function processArguments(
675661

676662
$errors[] = RuleErrorBuilder::message(sprintf($missingParameterMessage, sprintf('%s (%s)', $parameter->getName(), $parameter->getType()->describe(VerbosityLevel::typeOnly()))))
677663
->identifier('argument.missing')
678-
->line($line)
679664
->build();
680665
}
681666
}

0 commit comments

Comments
 (0)