@@ -56,10 +56,10 @@ public function testCachedParse()
56
56
->with ($ cacheItemMock )
57
57
;
58
58
59
- $ parsedExpression = $ expressionLanguage ->parse ('1 + 1 ' , array () );
59
+ $ parsedExpression = $ expressionLanguage ->parse ('1 + 1 ' , [] );
60
60
$ this ->assertSame ($ savedParsedExpression , $ parsedExpression );
61
61
62
- $ parsedExpression = $ expressionLanguage ->parse ('1 + 1 ' , array () );
62
+ $ parsedExpression = $ expressionLanguage ->parse ('1 + 1 ' , [] );
63
63
$ this ->assertSame ($ savedParsedExpression , $ parsedExpression );
64
64
}
65
65
@@ -74,7 +74,7 @@ public function testConstantFunction()
74
74
75
75
public function testProviders ()
76
76
{
77
- $ expressionLanguage = new ExpressionLanguage (null , array ( new TestProvider ()) );
77
+ $ expressionLanguage = new ExpressionLanguage (null , [ new TestProvider ()] );
78
78
$ this ->assertEquals ('foo ' , $ expressionLanguage ->evaluate ('identity("foo") ' ));
79
79
$ this ->assertEquals ('"foo" ' , $ expressionLanguage ->compile ('identity("foo") ' ));
80
80
$ this ->assertEquals ('FOO ' , $ expressionLanguage ->evaluate ('strtoupper("foo") ' ));
@@ -112,46 +112,46 @@ public function testShortCircuitOperatorsCompile($expression, array $names, $exp
112
112
public function testParseThrowsInsteadOfNotice ()
113
113
{
114
114
$ expressionLanguage = new ExpressionLanguage ();
115
- $ expressionLanguage ->parse ('node. ' , array ( 'node ' ) );
115
+ $ expressionLanguage ->parse ('node. ' , [ 'node ' ] );
116
116
}
117
117
118
118
public function shortCircuitProviderEvaluate ()
119
119
{
120
- $ object = $ this ->getMockBuilder ('stdClass ' )->setMethods (array ( 'foo ' ) )->getMock ();
120
+ $ object = $ this ->getMockBuilder ('stdClass ' )->setMethods ([ 'foo ' ] )->getMock ();
121
121
$ object ->expects ($ this ->never ())->method ('foo ' );
122
122
123
- return array (
124
- array ( 'false and object.foo() ' , array ( 'object ' => $ object) , false ) ,
125
- array ( 'false && object.foo() ' , array ( 'object ' => $ object) , false ) ,
126
- array ( 'true || object.foo() ' , array ( 'object ' => $ object) , true ) ,
127
- array ( 'true or object.foo() ' , array ( 'object ' => $ object) , true ) ,
128
- ) ;
123
+ return [
124
+ [ 'false and object.foo() ' , [ 'object ' => $ object] , false ] ,
125
+ [ 'false && object.foo() ' , [ 'object ' => $ object] , false ] ,
126
+ [ 'true || object.foo() ' , [ 'object ' => $ object] , true ] ,
127
+ [ 'true or object.foo() ' , [ 'object ' => $ object] , true ] ,
128
+ ] ;
129
129
}
130
130
131
131
public function shortCircuitProviderCompile ()
132
132
{
133
- return array (
134
- array ( 'false and foo ' , array ( 'foo ' => 'foo ' ) , false ) ,
135
- array ( 'false && foo ' , array ( 'foo ' => 'foo ' ) , false ) ,
136
- array ( 'true || foo ' , array ( 'foo ' => 'foo ' ) , true ) ,
137
- array ( 'true or foo ' , array ( 'foo ' => 'foo ' ) , true ) ,
138
- ) ;
133
+ return [
134
+ [ 'false and foo ' , [ 'foo ' => 'foo ' ] , false ] ,
135
+ [ 'false && foo ' , [ 'foo ' => 'foo ' ] , false ] ,
136
+ [ 'true || foo ' , [ 'foo ' => 'foo ' ] , true ] ,
137
+ [ 'true or foo ' , [ 'foo ' => 'foo ' ] , true ] ,
138
+ ] ;
139
139
}
140
140
141
141
public function testCachingForOverriddenVariableNames ()
142
142
{
143
143
$ expressionLanguage = new ExpressionLanguage ();
144
144
$ expression = 'a + b ' ;
145
- $ expressionLanguage ->evaluate ($ expression , array ( 'a ' => 1 , 'b ' => 1 ) );
146
- $ result = $ expressionLanguage ->compile ($ expression , array ( 'a ' , 'B ' => 'b ' ) );
145
+ $ expressionLanguage ->evaluate ($ expression , [ 'a ' => 1 , 'b ' => 1 ] );
146
+ $ result = $ expressionLanguage ->compile ($ expression , [ 'a ' , 'B ' => 'b ' ] );
147
147
$ this ->assertSame ('($a + $B) ' , $ result );
148
148
}
149
149
150
150
public function testStrictEquality ()
151
151
{
152
152
$ expressionLanguage = new ExpressionLanguage ();
153
153
$ expression = '123 === a ' ;
154
- $ result = $ expressionLanguage ->compile ($ expression , array ( 'a ' ) );
154
+ $ result = $ expressionLanguage ->compile ($ expression , [ 'a ' ] );
155
155
$ this ->assertSame ('(123 === $a) ' , $ result );
156
156
}
157
157
@@ -160,7 +160,7 @@ public function testCachingWithDifferentNamesOrder()
160
160
$ cacheMock = $ this ->getMockBuilder ('Psr\Cache\CacheItemPoolInterface ' )->getMock ();
161
161
$ cacheItemMock = $ this ->getMockBuilder ('Psr\Cache\CacheItemInterface ' )->getMock ();
162
162
$ expressionLanguage = new ExpressionLanguage ($ cacheMock );
163
- $ savedParsedExpressions = array () ;
163
+ $ savedParsedExpressions = [] ;
164
164
165
165
$ cacheMock
166
166
->expects ($ this ->exactly (2 ))
@@ -193,8 +193,8 @@ public function testCachingWithDifferentNamesOrder()
193
193
;
194
194
195
195
$ expression = 'a + b ' ;
196
- $ expressionLanguage ->compile ($ expression , array ( 'a ' , 'B ' => 'b ' ) );
197
- $ expressionLanguage ->compile ($ expression , array ( 'B ' => 'b ' , 'a ' ) );
196
+ $ expressionLanguage ->compile ($ expression , [ 'a ' , 'B ' => 'b ' ] );
197
+ $ expressionLanguage ->compile ($ expression , [ 'B ' => 'b ' , 'a ' ] );
198
198
}
199
199
200
200
/**
@@ -204,7 +204,7 @@ public function testCachingWithDifferentNamesOrder()
204
204
public function testRegisterAfterParse ($ registerCallback )
205
205
{
206
206
$ el = new ExpressionLanguage ();
207
- $ el ->parse ('1 + 1 ' , array () );
207
+ $ el ->parse ('1 + 1 ' , [] );
208
208
$ registerCallback ($ el );
209
209
}
210
210
@@ -226,7 +226,7 @@ public function testRegisterAfterEval($registerCallback)
226
226
public function testCallBadCallable ()
227
227
{
228
228
$ el = new ExpressionLanguage ();
229
- $ el ->evaluate ('foo.myfunction() ' , array ( 'foo ' => new \stdClass ()) );
229
+ $ el ->evaluate ('foo.myfunction() ' , [ 'foo ' => new \stdClass ()] );
230
230
}
231
231
232
232
/**
@@ -242,22 +242,22 @@ public function testRegisterAfterCompile($registerCallback)
242
242
243
243
public function getRegisterCallbacks ()
244
244
{
245
- return array (
246
- array (
245
+ return [
246
+ [
247
247
function (ExpressionLanguage $ el ) {
248
248
$ el ->register ('fn ' , function () {}, function () {});
249
249
},
250
- ) ,
251
- array (
250
+ ] ,
251
+ [
252
252
function (ExpressionLanguage $ el ) {
253
253
$ el ->addFunction (new ExpressionFunction ('fn ' , function () {}, function () {}));
254
254
},
255
- ) ,
256
- array (
255
+ ] ,
256
+ [
257
257
function (ExpressionLanguage $ el ) {
258
258
$ el ->registerProvider (new TestProvider ());
259
259
},
260
- ) ,
261
- ) ;
260
+ ] ,
261
+ ] ;
262
262
}
263
263
}
0 commit comments