Skip to content

Commit

Permalink
feature #4105 Deprecate the second argument of CallExpression::compil…
Browse files Browse the repository at this point in the history
…eArguments (fabpot)

This PR was merged into the 3.x branch.

Discussion
----------

Deprecate the second argument of CallExpression::compileArguments

Commits
-------

71d6c82 Deprecate CallExpression::compileArguments
  • Loading branch information
fabpot committed Jun 18, 2024
2 parents ab071ef + 71d6c82 commit ca39534
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 3.10.4 (2024-XX-XX)
# 3.11.0 (2024-XX-XX)

* n/a
* Deprecate the second argument of `Twig\Node\Expression\CallExpression::compileArguments()`

# 3.10.3 (2024-05-16)

Expand Down
7 changes: 7 additions & 0 deletions doc/deprecated.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ Extensions
After:
$twig->getRuntime(EscaperRuntime::class)->METHOD();

Nodes
-----

* The second argument of the
``Twig\Node\Expression\CallExpression::compileArguments()`` method is
deprecated.

Node Visitors
-------------

Expand Down
4 changes: 4 additions & 0 deletions src/Node/Expression/CallExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ protected function compileCallable(Compiler $compiler)

protected function compileArguments(Compiler $compiler, $isArray = false): void
{
if (func_num_args() >= 2) {
trigger_deprecation('twig/twig', '3.11', 'Passing a second argument to "%s()" is deprecated.', __METHOD__);
}

$compiler->raw($isArray ? '[' : '(');

$first = true;
Expand Down

0 comments on commit ca39534

Please sign in to comment.