@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | public function testCanComposeWithSafeStrings(): void |
191 | 191 | { |
192 | - $reutrnsArray = function ($e) { |
|
192 | + $reutrnsArray = function($e) { |
|
193 | 193 | return array(); |
194 | 194 | }; |
195 | 195 | |
@@ -416,8 +416,8 @@ discard block |
||
416 | 416 | |
417 | 417 | $this->assertNotNull($caseSenseAfter('rutoiuerot')); // No match |
418 | 418 | $this->assertNotNull($caseSenseAfter('QWERTABCEFG')); // Uppercase |
419 | - $this->assertEquals('', $caseSenseAfter('rutoiuerot'));// No match |
|
420 | - $this->assertEquals('', $caseSenseAfter('QWERTABCEFG'));// Uppercase |
|
419 | + $this->assertEquals('', $caseSenseAfter('rutoiuerot')); // No match |
|
420 | + $this->assertEquals('', $caseSenseAfter('QWERTABCEFG')); // Uppercase |
|
421 | 421 | |
422 | 422 | |
423 | 423 | $this->assertEquals('ABCEFG', $caseInsenseAfter('QWERTABCEFG')); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ), |
90 | 90 | array( |
91 | 91 | 'expected' => 4, |
92 | - 'test' => count(array( 1, 2, 3, 4 )), |
|
92 | + 'test' => count(array(1, 2, 3, 4)), |
|
93 | 93 | ), |
94 | 94 | ); |
95 | 95 | } else { |
@@ -176,27 +176,27 @@ discard block |
||
176 | 176 | if ($type === 'pass') { |
177 | 177 | return array( |
178 | 178 | array( |
179 | - 'expected' => array( 1, 2, 3, 4, 5 ), |
|
179 | + 'expected' => array(1, 2, 3, 4, 5), |
|
180 | 180 | 'test' => explode(',', '1,2,3,4,5'), |
181 | 181 | ), |
182 | 182 | array( |
183 | - 'expected' => array( 1, 2, 3, 'a', 'b', 'c' ), |
|
183 | + 'expected' => array(1, 2, 3, 'a', 'b', 'c'), |
|
184 | 184 | 'test' => array_merge( |
185 | - array( 1, 2, 3 ), |
|
186 | - array( 'a', 'b', 'c' ) |
|
185 | + array(1, 2, 3), |
|
186 | + array('a', 'b', 'c') |
|
187 | 187 | ), |
188 | 188 | ), |
189 | 189 | array( |
190 | - 'expected' => array( 2, 4, 6, 8, 10 ), |
|
190 | + 'expected' => array(2, 4, 6, 8, 10), |
|
191 | 191 | 'test' => array_map( |
192 | - function ($e) { |
|
192 | + function($e) { |
|
193 | 193 | return $e * 2; |
194 | 194 | }, |
195 | - array( 1, 2, 3, 4, 5 ) |
|
195 | + array(1, 2, 3, 4, 5) |
|
196 | 196 | ), |
197 | 197 | ), |
198 | 198 | array( |
199 | - 'expected' => array( 'name' => 'Barry' ), |
|
199 | + 'expected' => array('name' => 'Barry'), |
|
200 | 200 | 'test' => (array) new class () { |
201 | 201 | public $name = 'Barry'; |
202 | 202 | }, |
@@ -205,27 +205,27 @@ discard block |
||
205 | 205 | } else { |
206 | 206 | return array( |
207 | 207 | array( |
208 | - 'expected' => array( 1, 2, 3, 4, 5, 6 ), |
|
208 | + 'expected' => array(1, 2, 3, 4, 5, 6), |
|
209 | 209 | 'test' => explode(',', '1,2,3,4,5'), |
210 | 210 | ), |
211 | 211 | array( |
212 | - 'expected' => array( 1, 2, 3, 'a', 'b', 'd' ), |
|
212 | + 'expected' => array(1, 2, 3, 'a', 'b', 'd'), |
|
213 | 213 | 'test' => array_merge( |
214 | - array( 1, 2, 3 ), |
|
215 | - array( 'a', 'b', 'c' ) |
|
214 | + array(1, 2, 3), |
|
215 | + array('a', 'b', 'c') |
|
216 | 216 | ), |
217 | 217 | ), |
218 | 218 | array( |
219 | - 'expected' => array( 2, 4, 6, 8, 10 ), |
|
219 | + 'expected' => array(2, 4, 6, 8, 10), |
|
220 | 220 | 'test' => array_map( |
221 | - function ($e) { |
|
221 | + function($e) { |
|
222 | 222 | return $e * 3; |
223 | 223 | }, |
224 | - array( 1, 2, 3, 4, 5 ) |
|
224 | + array(1, 2, 3, 4, 5) |
|
225 | 225 | ), |
226 | 226 | ), |
227 | 227 | array( |
228 | - 'expected' => array( 'name' => 'Barry' ), |
|
228 | + 'expected' => array('name' => 'Barry'), |
|
229 | 229 | 'test' => (array) new class () { |
230 | 230 | public $name = 'Jane'; |
231 | 231 | }, |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | 'expected' => new class () { |
261 | 261 | public $name = 'Barry'; |
262 | 262 | }, |
263 | - 'test' => (object) array( 'name' => 'Barry' ), |
|
263 | + 'test' => (object) array('name' => 'Barry'), |
|
264 | 264 | ), |
265 | 265 | array( |
266 | 266 | 'expected' => (object) array( |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | 'test' => (object) array(), |
278 | 278 | ), |
279 | 279 | array( |
280 | - 'expected' => json_decode(json_encode(array( 'itWas' => 'anArray' ))), |
|
281 | - 'test' => (object) array( 'itWas' => 'anArray' ), |
|
280 | + 'expected' => json_decode(json_encode(array('itWas' => 'anArray'))), |
|
281 | + 'test' => (object) array('itWas' => 'anArray'), |
|
282 | 282 | ), |
283 | 283 | ); |
284 | 284 | } else { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | 'expected' => new class () { |
288 | 288 | public $name = 'Barry'; |
289 | 289 | }, |
290 | - 'test' => (object) array( 'name' => 'Daisy' ), |
|
290 | + 'test' => (object) array('name' => 'Daisy'), |
|
291 | 291 | ), |
292 | 292 | array( |
293 | 293 | 'expected' => (object) array( |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | }, |
301 | 301 | ), |
302 | 302 | array( |
303 | - 'expected' => (object) array( 'unlucky' => 'mate' ), |
|
303 | + 'expected' => (object) array('unlucky' => 'mate'), |
|
304 | 304 | 'test' => new \stdClass(), |
305 | 305 | ), |
306 | 306 | array( |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | ) |
313 | 313 | ) |
314 | 314 | ), |
315 | - 'test' => (object) array( 'itWas' => 'anArray' ), |
|
315 | + 'test' => (object) array('itWas' => 'anArray'), |
|
316 | 316 | ), |
317 | 317 | ); |
318 | 318 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | public $name = 'Jane'; |
339 | 339 | }, |
340 | 340 | ), |
341 | - 'haystack' => (object) array( 'name' => 'Barry' ), |
|
341 | + 'haystack' => (object) array('name' => 'Barry'), |
|
342 | 342 | ), |
343 | 343 | array( |
344 | 344 | 'needles' => array( |
@@ -357,16 +357,16 @@ discard block |
||
357 | 357 | }, |
358 | 358 | ), |
359 | 359 | array( |
360 | - 'needles' => array( 1, 2, 3, 4, 6 ), |
|
360 | + 'needles' => array(1, 2, 3, 4, 6), |
|
361 | 361 | 'haystack' => 4, |
362 | 362 | ), |
363 | 363 | array( |
364 | - 'needles' => array( 'a', 'b', 'c', 'd' ), |
|
364 | + 'needles' => array('a', 'b', 'c', 'd'), |
|
365 | 365 | 'haystack' => 'c', |
366 | 366 | ), |
367 | 367 | array( |
368 | - 'needles' => array( array( 'a' ), array( 'b' ), 'c', array( 'd' ) ), |
|
369 | - 'haystack' => array( 'a' ), |
|
368 | + 'needles' => array(array('a'), array('b'), 'c', array('d')), |
|
369 | + 'haystack' => array('a'), |
|
370 | 370 | ), |
371 | 371 | |
372 | 372 | ); |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | public $name = 'Jane'; |
382 | 382 | }, |
383 | 383 | ), |
384 | - 'haystack' => (object) array( 'name' => 'Rebbeca' ), |
|
384 | + 'haystack' => (object) array('name' => 'Rebbeca'), |
|
385 | 385 | ), |
386 | 386 | array( |
387 | 387 | 'needles' => array( |
@@ -400,16 +400,16 @@ discard block |
||
400 | 400 | }, |
401 | 401 | ), |
402 | 402 | array( |
403 | - 'needles' => array( 1, 2, 3, 4, 6 ), |
|
403 | + 'needles' => array(1, 2, 3, 4, 6), |
|
404 | 404 | 'haystack' => 41, |
405 | 405 | ), |
406 | 406 | array( |
407 | - 'needles' => array( 'a', 'b', 'c', 'd' ), |
|
407 | + 'needles' => array('a', 'b', 'c', 'd'), |
|
408 | 408 | 'haystack' => 'R', |
409 | 409 | ), |
410 | 410 | array( |
411 | - 'needles' => array( array( 'a' ), array( 'b' ), 'c', array( 'd' ) ), |
|
412 | - 'haystack' => array( 'a', 'B' ), |
|
411 | + 'needles' => array(array('a'), array('b'), 'c', array('d')), |
|
412 | + 'haystack' => array('a', 'B'), |
|
413 | 413 | ), |
414 | 414 | ); |
415 | 415 | } |
@@ -453,19 +453,19 @@ discard block |
||
453 | 453 | |
454 | 454 | ), |
455 | 455 | array( // Srray |
456 | - array( 'xx' ), |
|
457 | - array( true, false, null ), |
|
456 | + array('xx'), |
|
457 | + array(true, false, null), |
|
458 | 458 | explode(',', 'this,is,a,test,string'), |
459 | - array( array( 1, array( 1, 5, 6, 7, array( 44, array( 5 ) ) ) ) ), |
|
459 | + array(array(1, array(1, 5, 6, 7, array(44, array(5))))), |
|
460 | 460 | ), |
461 | 461 | array( // Object |
462 | 462 | new class () { |
463 | 463 | }, |
464 | - json_decode(json_encode(array( 'itWas' => 'anArray' ))), |
|
464 | + json_decode(json_encode(array('itWas' => 'anArray'))), |
|
465 | 465 | new DateTime('2020-01-01T15:03:01.012345Z'), |
466 | 466 | dir(__DIR__), |
467 | 467 | new \stdClass(), |
468 | - (object) array( 'iWasAlso' => 'anArray' ), |
|
468 | + (object) array('iWasAlso' => 'anArray'), |
|
469 | 469 | ), |
470 | 470 | ); |
471 | 471 | } else { |
@@ -478,21 +478,21 @@ discard block |
||
478 | 478 | (12 * 12), |
479 | 479 | __LINE__, |
480 | 480 | PHP_INT_MIN, |
481 | - json_decode(json_encode(array( 'itWas' => 'anArray' ))), |
|
481 | + json_decode(json_encode(array('itWas' => 'anArray'))), |
|
482 | 482 | new DateTime('2020-01-01T15:03:01.012345Z'), |
483 | 483 | E_USER_NOTICE, |
484 | 484 | sqrt(144), |
485 | 485 | (12 / 5), |
486 | 486 | M_PI, |
487 | - array( true, false, null ), |
|
487 | + array(true, false, null), |
|
488 | 488 | explode(',', 'this,is,a,test,string'), |
489 | 489 | hexdec('ee'), |
490 | 490 | bindec('110011'), |
491 | 491 | ), |
492 | 492 | array( // Array and casted arrays. |
493 | - array( 'xx' ), |
|
493 | + array('xx'), |
|
494 | 494 | explode(',', 'this,is,a,test,string'), |
495 | - (object) array( 'iWasAlso' => 'anArray' ), |
|
495 | + (object) array('iWasAlso' => 'anArray'), |
|
496 | 496 | ), |
497 | 497 | array( // Int, FLoat, String |
498 | 498 | 12, |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | 'HI mark hello', |
514 | 514 | 'HI claire hello', |
515 | 515 | ), |
516 | - 'expected' => array( 'HI john hello' ), |
|
516 | + 'expected' => array('HI john hello'), |
|
517 | 517 | 'function' => Arr\filterAnd( |
518 | 518 | Str\contains('john'), |
519 | 519 | Str\startsWith('HI') |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | 'HI mark hello', |
573 | 573 | 'HI claire hello', |
574 | 574 | ), |
575 | - 'expected' => array( 'HI john hello' ), |
|
575 | + 'expected' => array('HI john hello'), |
|
576 | 576 | 'function' => Arr\filterAnd( |
577 | 577 | Str\contains('John'), |
578 | 578 | Str\startsWith('HI') |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | Str\contains('APPLE'), |
634 | 634 | Str\startsWith('--') |
635 | 635 | ); |
636 | - $randomStrings = Comp\groupAnd( |
|
636 | + $randomStrings = Comp\groupAnd( |
|
637 | 637 | Str\contains('ffff'), |
638 | 638 | Str\contains('trt'), |
639 | 639 | Str\startsWith('dg') |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | |
700 | 700 | public static function groupedAndOrComparissonMixed(string $type): array |
701 | 701 | { |
702 | - $orAndOr1 = Comp\groupAnd( |
|
702 | + $orAndOr1 = Comp\groupAnd( |
|
703 | 703 | Comp\groupOr( |
704 | 704 | Str\contains('666'), |
705 | 705 | Str\contains('333') |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $array = array( |
27 | 27 | 1, |
28 | 28 | 2, |
29 | - array( 3, 4 ), |
|
29 | + array(3, 4), |
|
30 | 30 | array( |
31 | 31 | 5, |
32 | 32 | 6, |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | array( |
36 | 36 | 9, |
37 | 37 | 10, |
38 | - array( 11, 12, 13 ), |
|
38 | + array(11, 12, 13), |
|
39 | 39 | ), |
40 | 40 | ), |
41 | 41 | ); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $this->assertTrue(Comp\allTrue(true, true, 1 == 1, 4 === (3 + 1))); // t |
264 | 264 | $this->assertFalse(Comp\allTrue(true, true, 1 == 3, 4 === (3 + 1))); // f |
265 | 265 | $this->assertTrue(Comp\anyTrue(true, true, 1 == 3, 4 === (3 + 1))); //t |
266 | - $this->assertTrue(! Comp\allTrue(false, false, 1 == 3, 4 === (3 * 1))); //t |
|
266 | + $this->assertTrue(!Comp\allTrue(false, false, 1 == 3, 4 === (3 * 1))); //t |
|
267 | 267 | $this->assertFalse(Comp\allTrue(false, false, 1 == 3, 4 === (3 * 1))); //t |
268 | 268 | $this->assertFalse(Comp\anyTrue(false, false, 1 == 3, 4 === (3 * 1))); //f |
269 | 269 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $this->assertTrue(Comp\isTrue((bool) 1)); |
275 | 275 | $this->assertFalse(Comp\isTrue(false)); |
276 | 276 | $this->assertFalse(Comp\isTrue(0)); |
277 | - $this->assertFalse(Comp\isTrue(array( 0 ))); |
|
277 | + $this->assertFalse(Comp\isTrue(array(0))); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | public function testCanCheckIsFalse(): void |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | $this->assertTrue(Comp\isFalse((bool) 0)); |
284 | 284 | $this->assertFalse(Comp\isFalse(true)); |
285 | 285 | $this->assertFalse(Comp\isFalse(0)); |
286 | - $this->assertFalse(Comp\isFalse(array( 0 ))); |
|
286 | + $this->assertFalse(Comp\isFalse(array(0))); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | public function testNotEmpty() |
290 | 290 | { |
291 | - $this->assertTrue(Comp\notEmpty(array( false, 1, 2 ))); |
|
291 | + $this->assertTrue(Comp\notEmpty(array(false, 1, 2))); |
|
292 | 292 | $this->assertTrue(Comp\notEmpty('Hello')); |
293 | 293 | $this->assertFalse(Comp\notEmpty('')); |
294 | 294 | $this->assertFalse(Comp\notEmpty(array())); |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | public function testCanUseNot() |
298 | 298 | { |
299 | - $function = function ($a) { |
|
299 | + $function = function($a) { |
|
300 | 300 | return $a === 1; |
301 | 301 | }; |
302 | 302 |
@@ -20,18 +20,18 @@ |
||
20 | 20 | 'id' => 15, |
21 | 21 | 'active' => true, |
22 | 22 | 'decimal' => 1.23, |
23 | - 'name' => (object)[ |
|
23 | + 'name' => (object) [ |
|
24 | 24 | 'first' => 'Bob', |
25 | 25 | 'last' => 'Flemming' |
26 | 26 | ], |
27 | 27 | 'tags' => ['tag1', 'tag2', 'tag3'], |
28 | 28 | 'deepTags' => [ |
29 | - ['ref' => '13', 'records' => [ [1,4,56], [5,67,8] ] ], |
|
30 | - ['ref' => '16', 'records' => [ [4,8,79], [12,39,78] ] ], |
|
31 | - ['ref' => '37', 'records' => [ [123,8,3], [2,67,3], [12], [127, 854] ] ], |
|
29 | + ['ref' => '13', 'records' => [[1, 4, 56], [5, 67, 8]]], |
|
30 | + ['ref' => '16', 'records' => [[4, 8, 79], [12, 39, 78]]], |
|
31 | + ['ref' => '37', 'records' => [[123, 8, 3], [2, 67, 3], [12], [127, 854]]], |
|
32 | 32 | ], |
33 | 33 | 'broken' => [ |
34 | - 'data' => (object)[ |
|
34 | + 'data' => (object) [ |
|
35 | 35 | 'date' => time(), |
36 | 36 | 'content' => null |
37 | 37 | ] |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | public function testNotEmptyConstant() |
14 | 14 | { |
15 | 15 | // With arrays |
16 | - $this->assertTrue(call_user_func(Functions::NOT_EMPTY, array( 'test' ))); |
|
16 | + $this->assertTrue(call_user_func(Functions::NOT_EMPTY, array('test'))); |
|
17 | 17 | $this->assertFalse(call_user_func(Functions::NOT_EMPTY, array())); |
18 | 18 | |
19 | 19 | // With strings |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | /** @testdox It should be possible to use a constant for Arrays\head() as a callable */ |
25 | 25 | public function testArrayHead(): void |
26 | 26 | { |
27 | - $this->assertEquals('1', call_user_func(Functions::ARRAY_HEAD, array( '1', '2' ))); |
|
27 | + $this->assertEquals('1', call_user_func(Functions::ARRAY_HEAD, array('1', '2'))); |
|
28 | 28 | $this->assertNull(call_user_func(Functions::ARRAY_HEAD, array())); |
29 | 29 | } |
30 | 30 | |
31 | 31 | /** @testdox It should be possible to use a constant for Arrays\tail() as a callable */ |
32 | 32 | public function testArrayTail(): void |
33 | 33 | { |
34 | - $this->assertEquals('2', call_user_func(Functions::ARRAY_TAIL, array( '1', '2' ))); |
|
34 | + $this->assertEquals('2', call_user_func(Functions::ARRAY_TAIL, array('1', '2'))); |
|
35 | 35 | $this->assertNull(call_user_func(Functions::ARRAY_TAIL, array())); |
36 | 36 | } |
37 | 37 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->assertFalse(call_user_func(Functions::IS_TRUE, '1')); |
53 | 53 | |
54 | 54 | $this->assertFalse(call_user_func(Functions::IS_TRUE, array())); |
55 | - $this->assertFalse(call_user_func(Functions::IS_TRUE, array( 1, 2, 3 ))); |
|
55 | + $this->assertFalse(call_user_func(Functions::IS_TRUE, array(1, 2, 3))); |
|
56 | 56 | |
57 | 57 | $this->assertFalse(call_user_func(Functions::IS_TRUE, null)); |
58 | 58 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $this->assertFalse(call_user_func(Functions::IS_NUMBER, '1.1')); |
95 | 95 | |
96 | 96 | $this->assertFalse(call_user_func(Functions::IS_NUMBER, array())); |
97 | - $this->assertFalse(call_user_func(Functions::IS_NUMBER, array( 1, 2, 3 ))); |
|
97 | + $this->assertFalse(call_user_func(Functions::IS_NUMBER, array(1, 2, 3))); |
|
98 | 98 | |
99 | 99 | $this->assertFalse(call_user_func(Functions::IS_NUMBER, null)); |
100 | 100 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | public function testCanGroupByArray(): void |
122 | 122 | { |
123 | 123 | $groupByPerfectNumbers = Arr\groupBy( |
124 | - function ($e) { |
|
124 | + function($e) { |
|
125 | 125 | return in_array($e, array(1, 2, 3, 6, 12)) ? 'Perfect' : 'Not Perfect'; |
126 | 126 | } |
127 | 127 | ); |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | ); |
324 | 324 | |
325 | 325 | $costSum = Arr\sumWhere( |
326 | - function ($e) { |
|
326 | + function($e) { |
|
327 | 327 | return $e->cost; |
328 | 328 | } |
329 | 329 | ); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | 'h' => -4, |
363 | 363 | ); |
364 | 364 | |
365 | - $lowestFirstCallback = function ($a, $b) { |
|
365 | + $lowestFirstCallback = function($a, $b) { |
|
366 | 366 | if ($a == $b) { |
367 | 367 | return 0; |
368 | 368 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | { |
390 | 390 | $array = array(3, 2, 5, 6, 1); |
391 | 391 | |
392 | - $lowestFirstCallback = function ($a, $b) { |
|
392 | + $lowestFirstCallback = function($a, $b) { |
|
393 | 393 | if ($a == $b) { |
394 | 394 | return 0; |
395 | 395 | } |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | |
410 | 410 | public function testCanPartitionTable() |
411 | 411 | { |
412 | - $isEven = function ($e) { |
|
412 | + $isEven = function($e) { |
|
413 | 413 | return $e % 2 === 0; |
414 | 414 | }; |
415 | 415 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | public function testFunctionCompseSafeHandlesNull(): void |
87 | 87 | { |
88 | - $reutrnsNull = function ($e) { |
|
88 | + $reutrnsNull = function($e) { |
|
89 | 89 | return null; |
90 | 90 | }; |
91 | 91 | |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | |
151 | 151 | public function testCanUsePluckProperty() |
152 | 152 | { |
153 | - $data = (object)[ |
|
153 | + $data = (object) [ |
|
154 | 154 | 'alpha' => [ |
155 | - 'bravo' => (object)[ |
|
155 | + 'bravo' => (object) [ |
|
156 | 156 | 'charlie' => [ |
157 | 157 | 'delta' => 'SPOONS' |
158 | 158 | ] |
@@ -169,31 +169,31 @@ discard block |
||
169 | 169 | |
170 | 170 | public function testCanUseRecordEncoder() |
171 | 171 | { |
172 | - $data = (object)[ |
|
173 | - 'post' => (object)[ |
|
172 | + $data = (object) [ |
|
173 | + 'post' => (object) [ |
|
174 | 174 | 'id' => 123, |
175 | 175 | 'title' => 'Lorem ipsum dolor', |
176 | 176 | 'content' => 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Similique iste voluptatum sequi. Officia dignissimos minus ipsum odit, facilis voluptatibus veniam enim molestiae ipsam quae temporibus porro necessitatibus quia non mollitia!', |
177 | 177 | 'date' => (new DateTime())->format('d/m/yy H:m'), |
178 | - 'author' => (object)[ |
|
178 | + 'author' => (object) [ |
|
179 | 179 | 'userName' => 'someUser12', |
180 | 180 | 'displayName' => 'Sam Smith' |
181 | 181 | ], |
182 | 182 | 'url' => 'https://www.url.tld/post/123/lorem-ipsum-dolor' |
183 | 183 | ], |
184 | 184 | 'comments' => [ |
185 | - (object)[ |
|
185 | + (object) [ |
|
186 | 186 | 'post' => 123, |
187 | - 'author' => (object)[ |
|
187 | + 'author' => (object) [ |
|
188 | 188 | 'userName' => 'someUser2', |
189 | 189 | 'displayName' => 'Jane Jameson', |
190 | 190 | 'comment' => 'Lorem ipsum dolor sit, amet consectetur adipisicing elit. Hic, illo tempore repudiandae quos vero, vitae aut ullam tenetur officiis accusantium dolor animi ipsa omnis impedit, saepe est harum quisquam sit.', |
191 | 191 | 'date' => (new DateTime('yesterday'))->format('d/m/yy H:m'), |
192 | 192 | ] |
193 | 193 | ], |
194 | - (object)[ |
|
194 | + (object) [ |
|
195 | 195 | 'post' => 123, |
196 | - 'author' => (object)[ |
|
196 | + 'author' => (object) [ |
|
197 | 197 | 'userName' => 'someUser22', |
198 | 198 | 'displayName' => 'Barry Burton', |
199 | 199 | 'comment' => 'Lorem ipsum dolor sit, amet consectetur adipisicing elit. Hic, illo tempore repudiandae quos vero, vitae aut ullam tenetur officiis accusantium dolor animi ipsa omnis impedit, saepe est harum quisquam sit.', |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | // Check it returns blank array if any other value passed. |
295 | 295 | $this->assertEmpty($toArrray(false)); |
296 | 296 | $this->assertEmpty($toArrray(null)); |
297 | - $this->assertEmpty($toArrray([1,2,3,4])); |
|
297 | + $this->assertEmpty($toArrray([1, 2, 3, 4])); |
|
298 | 298 | $this->assertEmpty($toArrray(1)); |
299 | 299 | $this->assertEmpty($toArrray(2.5)); |
300 | 300 | $this->assertEmpty($toArrray('STRING')); |
@@ -193,22 +193,22 @@ |
||
193 | 193 | public function testCanUseFlatMap(): void |
194 | 194 | { |
195 | 195 | $array = array( |
196 | - 0, |
|
197 | - 1, |
|
198 | - 2, |
|
199 | - array( 3, 4 ), |
|
200 | - array( |
|
201 | - array(), |
|
202 | - 5, |
|
203 | - 6, |
|
204 | - 7, |
|
205 | - 8, |
|
206 | - array( |
|
207 | - 9, |
|
208 | - 10, |
|
209 | - array( 11, 12, 13 ), |
|
210 | - ), |
|
211 | - ), |
|
196 | + 0, |
|
197 | + 1, |
|
198 | + 2, |
|
199 | + array( 3, 4 ), |
|
200 | + array( |
|
201 | + array(), |
|
202 | + 5, |
|
203 | + 6, |
|
204 | + 7, |
|
205 | + 8, |
|
206 | + array( |
|
207 | + 9, |
|
208 | + 10, |
|
209 | + array( 11, 12, 13 ), |
|
210 | + ), |
|
211 | + ), |
|
212 | 212 | ); |
213 | 213 | |
214 | 214 | $doubleNFlattenIt = Arr\flatMap( |
@@ -83,36 +83,36 @@ discard block |
||
83 | 83 | public function testCanFilterLast(): void |
84 | 84 | { |
85 | 85 | $lastEven = Arr\filterLast( |
86 | - function ($e) { |
|
86 | + function($e) { |
|
87 | 87 | return $e % 2 === 0; |
88 | 88 | } |
89 | 89 | ); |
90 | - $this->assertEquals(6, $lastEven(array( 1, 3, 4, 6 ))); |
|
91 | - $this->assertEquals(8, $lastEven(array( 1, 3, 5, 7, 9, 6, 8 ))); |
|
92 | - $this->assertNull($lastEven(array( 1, 3, 3 ))); |
|
90 | + $this->assertEquals(6, $lastEven(array(1, 3, 4, 6))); |
|
91 | + $this->assertEquals(8, $lastEven(array(1, 3, 5, 7, 9, 6, 8))); |
|
92 | + $this->assertNull($lastEven(array(1, 3, 3))); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | public function testCanFilterFirst(): void |
96 | 96 | { |
97 | 97 | $firstEven = Arr\filterFirst( |
98 | - function ($e) { |
|
98 | + function($e) { |
|
99 | 99 | return $e % 2 === 0; |
100 | 100 | } |
101 | 101 | ); |
102 | - $this->assertEquals(6, $firstEven(array( 1, 3, 6 ))); |
|
103 | - $this->assertEquals(8, $firstEven(array( 1, 3, 5, 7, 9, 8 ))); |
|
104 | - $this->assertNull($firstEven(array( 1, 3, 3 ))); |
|
102 | + $this->assertEquals(6, $firstEven(array(1, 3, 6))); |
|
103 | + $this->assertEquals(8, $firstEven(array(1, 3, 5, 7, 9, 8))); |
|
104 | + $this->assertNull($firstEven(array(1, 3, 3))); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | public function testCanFilterMap() |
108 | 108 | { |
109 | - $nums = [1,2,3,4,5,6,7,8,9,10]; |
|
109 | + $nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; |
|
110 | 110 | $doubledEvenNumbers = Arr\filterMap( |
111 | - function ($a) { |
|
111 | + function($a) { |
|
112 | 112 | // is even |
113 | 113 | return $a % 2 === 0; |
114 | 114 | }, |
115 | - function ($b) { |
|
115 | + function($b) { |
|
116 | 116 | // double it |
117 | 117 | return $b * 2; |
118 | 118 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | { |
153 | 153 | $array = range(1, 10); |
154 | 154 | $mapWithCheese = Arr\mapWith( |
155 | - function ($e, $cheese) { |
|
155 | + function($e, $cheese) { |
|
156 | 156 | return "$e loves $cheese"; |
157 | 157 | }, |
158 | 158 | 'CHEESE!!!!!' |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $this->assertEquals('9 loves CHEESE!!!!!', $mapWithCheese($array)[8]); |
163 | 163 | |
164 | 164 | $mapWithMORECheese = Arr\mapWith( |
165 | - function ($e, $cheese, $more) { |
|
165 | + function($e, $cheese, $more) { |
|
166 | 166 | return "$e loves $cheese.......$more"; |
167 | 167 | }, |
168 | 168 | 'CHEESE!!!!!', |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | 0, |
197 | 197 | 1, |
198 | 198 | 2, |
199 | - array( 3, 4 ), |
|
199 | + array(3, 4), |
|
200 | 200 | array( |
201 | 201 | array(), |
202 | 202 | 5, |
@@ -206,13 +206,13 @@ discard block |
||
206 | 206 | array( |
207 | 207 | 9, |
208 | 208 | 10, |
209 | - array( 11, 12, 13 ), |
|
209 | + array(11, 12, 13), |
|
210 | 210 | ), |
211 | 211 | ), |
212 | 212 | ); |
213 | 213 | |
214 | 214 | $doubleNFlattenIt = Arr\flatMap( |
215 | - function ($e) { |
|
215 | + function($e) { |
|
216 | 216 | return $e * 2; |
217 | 217 | } |
218 | 218 | ); |