Skip to content

Conversation

@peterfox
Copy link
Contributor

Changes

  • Adds a new check in ParamAnalyzer to look for the use of func_get_args within a method
  • Adds a test fixture for RemoveUnusedConstructorParamRector to skip when func_get_args

Why

I found this issue popping up if func_get_args was used in a constructor. In theory there's also func_get_arg(int position) to consider as well but it's a question of either:

  1. refactor the analyzer to consider param position or
  2. just outright skip any methods that use func_get_arg() as well

@TomasVotruba TomasVotruba merged commit 220f33b into rectorphp:main Jun 19, 2025
45 checks passed
@TomasVotruba
Copy link
Member

Nice one, thank you 👍

return $this->nodeNameResolver->isNames($param, $arguments);
}

private function isFuncGetArgsCall(Node $node): bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should can use VariadicFunctionLikeDetector::isVariadic() that cover 3 functions:

  • func_get_arg
  • func_get_args
  • func_num_args

public function isVariadic(FunctionLike $functionLike): bool

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created PR for it:

to merge functionality into ParamAnalyzer and remove the VariadicFunctionLikeDetector as double work and cause manually called.

@github-actions
Copy link
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants