@@ -423,7 +423,6 @@ public static function cycle($values, $position): mixed
423423
424424 if (!is_countable ($ values )) {
425425 throw new RuntimeError ('The "cycle" function expects a countable sequence as first argument. ' );
426-
427426 $ values = self ::toArray ($ values , false );
428427 }
429428 }
@@ -1116,9 +1115,9 @@ public static function compare($a, $b)
11161115 }
11171116 if ((int ) $ bTrim == $ bTrim ) {
11181117 return $ a <=> (int ) $ bTrim ;
1119- } else {
1120- return (float ) $ a <=> (float ) $ bTrim ;
11211118 }
1119+
1120+ return (float ) $ a <=> (float ) $ bTrim ;
11221121 }
11231122 if (\is_string ($ a ) && \is_int ($ b )) {
11241123 $ aTrim = trim ($ a , " \t\n\r\v\f" );
@@ -1127,9 +1126,9 @@ public static function compare($a, $b)
11271126 }
11281127 if ((int ) $ aTrim == $ aTrim ) {
11291128 return (int ) $ aTrim <=> $ b ;
1130- } else {
1131- return (float ) $ aTrim <=> (float ) $ b ;
11321129 }
1130+
1131+ return (float ) $ aTrim <=> (float ) $ b ;
11331132 }
11341133
11351134 // float <=> string
@@ -1167,7 +1166,7 @@ public static function compare($a, $b)
11671166 */
11681167 public static function matches (string $ regexp , ?string $ str ): int
11691168 {
1170- set_error_handler (function ($ t , $ m ) use ($ regexp ) {
1169+ set_error_handler (static function ($ t , $ m ) use ($ regexp ) {
11711170 throw new RuntimeError (\sprintf ('Regexp "%s" passed to "matches" is not valid ' , $ regexp ).substr ($ m , 12 ));
11721171 });
11731172 try {
@@ -2020,7 +2019,7 @@ public static function parseParentFunction(Parser $parser, Node $fakeNode, $args
20202019 */
20212020 public static function parseBlockFunction (Parser $ parser , Node $ fakeNode , $ args , int $ line ): AbstractExpression
20222021 {
2023- $ fakeFunction = new TwigFunction ('block ' , fn ($ name , $ template = null ) => null );
2022+ $ fakeFunction = new TwigFunction ('block ' , static fn ($ name , $ template = null ) => null );
20242023 $ args = (new CallableArgumentsExtractor ($ fakeNode , $ fakeFunction ))->extractArguments ($ args );
20252024
20262025 return new BlockReferenceExpression ($ args [0 ], $ args [1 ] ?? null , $ line );
@@ -2031,7 +2030,7 @@ public static function parseBlockFunction(Parser $parser, Node $fakeNode, $args,
20312030 */
20322031 public static function parseAttributeFunction (Parser $ parser , Node $ fakeNode , $ args , int $ line ): AbstractExpression
20332032 {
2034- $ fakeFunction = new TwigFunction ('attribute ' , fn ($ variable , $ attribute , $ arguments = null ) => null );
2033+ $ fakeFunction = new TwigFunction ('attribute ' , static fn ($ variable , $ attribute , $ arguments = null ) => null );
20352034 $ args = (new CallableArgumentsExtractor ($ fakeNode , $ fakeFunction ))->extractArguments ($ args );
20362035
20372036 /*
@@ -2051,7 +2050,7 @@ public static function parseAttributeFunction(Parser $parser, Node $fakeNode, $a
20512050 */
20522051 public static function parseLoopFunction (Parser $ parser , Node $ fakeNode , $ args , int $ line ): AbstractExpression
20532052 {
2054- $ fakeFunction = new TwigFunction ('loop ' , fn ($ iterator ) => null );
2053+ $ fakeFunction = new TwigFunction ('loop ' , static fn ($ iterator ) => null );
20552054 $ args = (new CallableArgumentsExtractor ($ fakeNode , $ fakeFunction ))->extractArguments ($ args );
20562055
20572056 $ recurseArgs = new ArrayExpression ([new ConstantExpression (0 , $ line ), $ args [0 ]], $ line );
0 commit comments