@@ -530,7 +530,7 @@ public function getFunctionNode($name, $line)
530530 return new MacroReferenceExpression ($ alias ['node ' ]->getNode ('var ' ), $ alias ['name ' ], $ this ->createArguments ($ line ), $ line );
531531 }
532532
533- $ args = $ this ->parseOnlyArguments ();
533+ $ args = $ this ->parseNamedArguments ();
534534 $ function = $ this ->getFunction ($ name , $ line );
535535
536536 if ($ function ->getParserCallable ()) {
@@ -579,7 +579,7 @@ public function parseFilterExpressionRaw($node)
579579 if (!$ this ->parser ->getStream ()->test (Token::PUNCTUATION_TYPE , '( ' )) {
580580 $ arguments = new EmptyNode ();
581581 } else {
582- $ arguments = $ this ->parseOnlyArguments ();
582+ $ arguments = $ this ->parseNamedArguments ();
583583 }
584584
585585 $ filter = $ this ->getFilter ($ token ->getValue (), $ token ->getLine ());
@@ -611,9 +611,13 @@ public function parseFilterExpressionRaw($node)
611611 * @return Node
612612 *
613613 * @throws SyntaxError
614+ *
615+ * @deprecated since Twig 3.19 Use parseNamedArguments() instead
614616 */
615617 public function parseArguments ()
616618 {
619+ trigger_deprecation ('twig/twig ' , '3.19 ' , \sprintf ('The "%s()" method is deprecated, use "%s::parseNamedArguments()" instead. ' , __METHOD__ , __CLASS__ ));
620+
617621 $ namedArguments = false ;
618622 $ definition = false ;
619623 if (\func_num_args () > 1 ) {
@@ -738,7 +742,7 @@ private function parseTestExpression(Node $node): TestExpression
738742
739743 $ arguments = null ;
740744 if ($ stream ->test (Token::PUNCTUATION_TYPE , '( ' )) {
741- $ arguments = $ this ->parseOnlyArguments ();
745+ $ arguments = $ this ->parseNamedArguments ();
742746 } elseif ($ test ->hasOneMandatoryArgument ()) {
743747 $ arguments = new Nodes ([0 => $ this ->getPrimary ()]);
744748 }
@@ -864,14 +868,24 @@ private function setDeprecationCheck(bool $deprecationCheck): bool
864868 private function createArguments (int $ line ): ArrayExpression
865869 {
866870 $ arguments = new ArrayExpression ([], $ line );
867- foreach ($ this ->parseOnlyArguments () as $ k => $ n ) {
871+ foreach ($ this ->parseNamedArguments () as $ k => $ n ) {
868872 $ arguments ->addElement ($ n , new LocalVariable ($ k , $ line ));
869873 }
870874
871875 return $ arguments ;
872876 }
873877
878+ /**
879+ * @deprecated since Twig 3.19 Use parseNamedArguments() instead
880+ */
874881 public function parseOnlyArguments ()
882+ {
883+ trigger_deprecation ('twig/twig ' , '3.19 ' , \sprintf ('The "%s()" method is deprecated, use "%s::parseNamedArguments()" instead. ' , __METHOD__ , __CLASS__ ));
884+
885+ return $ this ->parseNamedArguments ();
886+ }
887+
888+ public function parseNamedArguments (): Nodes
875889 {
876890 $ args = [];
877891 $ stream = $ this ->parser ->getStream ();
0 commit comments