@@ -134,7 +134,7 @@ final class CoreExtension extends AbstractExtension
134134
135135 private $ dateFormats = ['F j, Y H:i ' , '%d days ' ];
136136 private $ numberFormat = [0 , '. ' , ', ' ];
137- private $ timezone = null ;
137+ private $ timezone ;
138138
139139 /**
140140 * Sets the default format to be used by the date filter.
@@ -1128,9 +1128,9 @@ public static function compare($a, $b)
11281128 }
11291129 if ((int ) $ bTrim == $ bTrim ) {
11301130 return $ a <=> (int ) $ bTrim ;
1131- } else {
1132- return (float ) $ a <=> (float ) $ bTrim ;
11331131 }
1132+
1133+ return (float ) $ a <=> (float ) $ bTrim ;
11341134 }
11351135 if (\is_string ($ a ) && \is_int ($ b )) {
11361136 $ aTrim = trim ($ a , " \t\n\r\v\f" );
@@ -1139,9 +1139,9 @@ public static function compare($a, $b)
11391139 }
11401140 if ((int ) $ aTrim == $ aTrim ) {
11411141 return (int ) $ aTrim <=> $ b ;
1142- } else {
1143- return (float ) $ aTrim <=> (float ) $ b ;
11441142 }
1143+
1144+ return (float ) $ aTrim <=> (float ) $ b ;
11451145 }
11461146
11471147 // float <=> string
@@ -1179,7 +1179,7 @@ public static function compare($a, $b)
11791179 */
11801180 public static function matches (string $ regexp , ?string $ str ): int
11811181 {
1182- set_error_handler (function ($ t , $ m ) use ($ regexp ) {
1182+ set_error_handler (static function ($ t , $ m ) use ($ regexp ) {
11831183 throw new RuntimeError (\sprintf ('Regexp "%s" passed to "matches" is not valid ' , $ regexp ).substr ($ m , 12 ));
11841184 });
11851185 try {
@@ -2148,7 +2148,7 @@ public static function parseParentFunction(Parser $parser, Node $fakeNode, $args
21482148 */
21492149 public static function parseBlockFunction (Parser $ parser , Node $ fakeNode , $ args , int $ line ): AbstractExpression
21502150 {
2151- $ fakeFunction = new TwigFunction ('block ' , fn ($ name , $ template = null ) => null );
2151+ $ fakeFunction = new TwigFunction ('block ' , static fn ($ name , $ template = null ) => null );
21522152 $ args = (new CallableArgumentsExtractor ($ fakeNode , $ fakeFunction ))->extractArguments ($ args );
21532153
21542154 return new BlockReferenceExpression ($ args [0 ], $ args [1 ] ?? null , $ line );
@@ -2159,7 +2159,7 @@ public static function parseBlockFunction(Parser $parser, Node $fakeNode, $args,
21592159 */
21602160 public static function parseAttributeFunction (Parser $ parser , Node $ fakeNode , $ args , int $ line ): AbstractExpression
21612161 {
2162- $ fakeFunction = new TwigFunction ('attribute ' , fn ($ variable , $ attribute , $ arguments = null ) => null );
2162+ $ fakeFunction = new TwigFunction ('attribute ' , static fn ($ variable , $ attribute , $ arguments = null ) => null );
21632163 $ args = (new CallableArgumentsExtractor ($ fakeNode , $ fakeFunction ))->extractArguments ($ args );
21642164
21652165 /*
0 commit comments