@@ -505,7 +505,7 @@ public function getFunctionNode($name, $line)
505
505
return $ node ;
506
506
}
507
507
508
- $ args = $ this ->parseArguments (true );
508
+ $ args = $ this ->parseArguments ();
509
509
$ function = $ this ->getFunction ($ name , $ line );
510
510
511
511
if ($ function ->getParserCallable ()) {
@@ -615,7 +615,7 @@ public function parseFilterExpressionRaw($node)
615
615
if (!$ this ->parser ->getStream ()->test (Token::PUNCTUATION_TYPE , '( ' )) {
616
616
$ arguments = new EmptyNode ();
617
617
} else {
618
- $ arguments = $ this ->parseArguments (true );
618
+ $ arguments = $ this ->parseArguments ();
619
619
}
620
620
621
621
$ filter = $ this ->getFilter ($ token ->getValue (), $ token ->getLine ());
@@ -635,19 +635,14 @@ public function parseFilterExpressionRaw($node)
635
635
/**
636
636
* Parses arguments.
637
637
*
638
- * @param bool $namedArguments Whether to allow named arguments or not
639
- * @param bool $definition Whether we are parsing arguments for a function (or macro) definition
638
+ * @param bool $definition Whether we are parsing arguments for a function (or macro) definition
640
639
*
641
640
* @return Node
642
641
*
643
642
* @throws SyntaxError
644
643
*/
645
- public function parseArguments ($ namedArguments = false , $ definition = false )
644
+ public function parseArguments ($ namedArguments = true , $ definition = false )
646
645
{
647
- if (!$ namedArguments ) {
648
- trigger_deprecation ('twig/twig ' , '3.15 ' , 'Passing "false" for the first argument ($namedArguments) to "%s()" is deprecated. ' , __METHOD__ );
649
- }
650
-
651
646
$ args = [];
652
647
$ stream = $ this ->parser ->getStream ();
653
648
@@ -678,7 +673,7 @@ public function parseArguments($namedArguments = false, $definition = false)
678
673
}
679
674
680
675
$ name = null ;
681
- if ($ namedArguments && (( $ token = $ stream ->nextIf (Token::OPERATOR_TYPE , '= ' )) || ($ token = $ stream ->nextIf (Token::PUNCTUATION_TYPE , ': ' ) ))) {
676
+ if (( $ token = $ stream ->nextIf (Token::OPERATOR_TYPE , '= ' )) || ($ token = $ stream ->nextIf (Token::PUNCTUATION_TYPE , ': ' ))) {
682
677
if (!$ value instanceof NameExpression) {
683
678
throw new SyntaxError (\sprintf ('A parameter name must be a string, "%s" given. ' , $ value ::class), $ token ->getLine (), $ stream ->getSourceContext ());
684
679
}
@@ -766,7 +761,7 @@ private function parseTestExpression(Node $node): TestExpression
766
761
767
762
$ arguments = null ;
768
763
if ($ stream ->test (Token::PUNCTUATION_TYPE , '( ' )) {
769
- $ arguments = $ this ->parseArguments (true );
764
+ $ arguments = $ this ->parseArguments ();
770
765
} elseif ($ test ->hasOneMandatoryArgument ()) {
771
766
$ arguments = new Nodes ([0 => $ this ->getPrimary ()]);
772
767
}
@@ -883,7 +878,7 @@ private function setDeprecationCheck(bool $deprecationCheck): bool
883
878
private function createArguments (int $ line ): ArrayExpression
884
879
{
885
880
$ arguments = new ArrayExpression ([], $ line );
886
- foreach ($ this ->parseArguments (true ) as $ k => $ n ) {
881
+ foreach ($ this ->parseArguments () as $ k => $ n ) {
887
882
$ arguments ->addElement ($ n , new TempNameExpression ($ k , $ line ));
888
883
}
889
884
0 commit comments