Skip to content

Commit

Permalink
minor #4401 reduce the deprecation noise when more than one argument …
Browse files Browse the repository at this point in the history
…is passed (xabbuh)

This PR was merged into the 3.x branch.

Discussion
----------

reduce the deprecation noise when more than one argument is passed

When more than one argument is passed to parseArguments(), one deprecation is triggered for each argument. Since passing any argument is deprecated the number of triggered deprecations can be reduced for more than one argument being passed.

Commits
-------

26256fc reduce the deprecation noise when more than one argument is passed
  • Loading branch information
fabpot committed Oct 20, 2024
2 parents bde4efa + 26256fc commit bcceaa3
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/ExpressionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -697,15 +697,11 @@ public function parseArguments()
{
$namedArguments = false;
$definition = false;
if (func_num_args() > 2) {
trigger_deprecation('twig/twig', '3.15', 'Passing a third argument ($allowArrow) to "%s()" is deprecated.', __METHOD__);
}
if (func_num_args() > 1) {
trigger_deprecation('twig/twig', '3.15', 'Passing a second argument ($definition) to "%s()" is deprecated.', __METHOD__);
$definition = func_get_arg(1);
}
if (func_num_args() > 0) {
trigger_deprecation('twig/twig', '3.15', 'Passing a first argument ($namedArguments) to "%s()" is deprecated.', __METHOD__);
trigger_deprecation('twig/twig', '3.15', 'Passing arguments to "%s()" is deprecated.', __METHOD__);
$namedArguments = func_get_arg(0);
}

Expand Down

0 comments on commit bcceaa3

Please sign in to comment.