Completed
Push — master ( 725917...d700db )
by Terry
01:40
created
src/Assert.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     }
281 281
 
282 282
     /**
283
-     * @param $exceptionClass
283
+     * @param string $exceptionClass
284 284
      * @return Assert
285 285
      */
286 286
     public function setExceptionClass($exceptionClass)
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
     /**
1409 1409
      * Alias of {@see choice()}
1410 1410
      *
1411
-     * @param array       $choices
1411
+     * @param integer[]       $choices
1412 1412
      * @param string|null $message
1413 1413
      * @param string|null $fieldName
1414 1414
      * @return Assert
@@ -2532,8 +2532,8 @@  discard block
 block discarded – undo
2532 2532
 
2533 2533
     /**
2534 2534
      * @param      $interfaceName
2535
-     * @param null $message
2536
-     * @param null $fieldName
2535
+     * @param string|null $message
2536
+     * @param string|null $fieldName
2537 2537
      * @return $this
2538 2538
      * @throws AssertionFailedException
2539 2539
      * @throws \ReflectionException
@@ -2728,7 +2728,7 @@  discard block
 block discarded – undo
2728 2728
     }
2729 2729
 
2730 2730
     /**
2731
-     * @param $func
2731
+     * @param string $func
2732 2732
      * @param $args
2733 2733
      * @return bool
2734 2734
      * @throws AssertionFailedException
Please login to merge, or discard this patch.
Spacing   +309 added lines, -309 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Terah\Assert;
4 4
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      *
135 135
      * @var string
136 136
      */
137
-    protected $exceptionClass           = 'Terah\Assert\AssertionFailedException';
137
+    protected $exceptionClass = 'Terah\Assert\AssertionFailedException';
138 138
 
139 139
     /**
140 140
      * @param mixed $value
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public static function runValidators(array $validators) : array
153 153
     {
154
-        $errors = [];
155
-        foreach ( $validators as $fieldName => $validator )
154
+        $errors = [ ];
155
+        foreach ($validators as $fieldName => $validator)
156 156
         {
157 157
             try
158 158
             {
159 159
 
160 160
                 $validator->__invoke();
161 161
             }
162
-            catch ( AssertionFailedException $e )
162
+            catch (AssertionFailedException $e)
163 163
             {
164
-                $errors[$fieldName]     = $e->getMessage();
164
+                $errors[ $fieldName ] = $e->getMessage();
165 165
             }
166 166
         }
167 167
 
@@ -176,22 +176,22 @@  discard block
 block discarded – undo
176 176
      * @param string $level
177 177
      * @return Assert
178 178
      */
179
-    public static function that($value, string $fieldName='', $code=0, $error='', $level=Assert::WARNING)
179
+    public static function that($value, string $fieldName = '', $code = 0, $error = '', $level = Assert::WARNING)
180 180
     {
181 181
         $assert = new static($value);
182
-        if ( $fieldName )
182
+        if ($fieldName)
183 183
         {
184 184
             $assert->fieldName($fieldName);
185 185
         }
186
-        if ( $code )
186
+        if ($code)
187 187
         {
188 188
             $assert->code($code);
189 189
         }
190
-        if ( $error )
190
+        if ($error)
191 191
         {
192 192
             $assert->error($error);
193 193
         }
194
-        if ( $level )
194
+        if ($level)
195 195
         {
196 196
             $assert->level($level);
197 197
         }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
      * @param string $level
271 271
      * @return AssertionFailedException
272 272
      */
273
-    protected function createException($message, $code, string $fieldName, array $constraints = [], $level=null)
273
+    protected function createException($message, $code, string $fieldName, array $constraints = [ ], $level = null)
274 274
     {
275 275
         $exceptionClass = $this->exceptionClass;
276 276
         $fieldName      = empty($fieldName) ? $this->fieldName : $fieldName;
@@ -360,13 +360,13 @@  discard block
 block discarded – undo
360 360
      * @return Assert
361 361
      * @throws AssertionFailedException
362 362
      */
363
-    public function eq($value2, string $message='', string $fieldName='')
363
+    public function eq($value2, string $message = '', string $fieldName = '')
364 364
     {
365
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
365
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
366 366
         {
367 367
             return $this;
368 368
         }
369
-        if ( $this->value != $value2 )
369
+        if ($this->value != $value2)
370 370
         {
371 371
             $message = $message ?: $this->overrideError;
372 372
             $message = sprintf(
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
                 $this->stringify($value2)
376 376
             );
377 377
 
378
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $fieldName, ['expected' => $value2]);
378
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $fieldName, [ 'expected' => $value2 ]);
379 379
         }
380 380
 
381 381
         return $this;
@@ -390,13 +390,13 @@  discard block
 block discarded – undo
390 390
      * @return Assert
391 391
      * @throws AssertionFailedException
392 392
      */
393
-    public function greaterThan($value2, string $message='', string $fieldName='')
393
+    public function greaterThan($value2, string $message = '', string $fieldName = '')
394 394
     {
395
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
395
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
396 396
         {
397 397
             return $this;
398 398
         }
399
-        if ( ! ( $this->value > $value2 ) )
399
+        if ( ! ($this->value > $value2))
400 400
         {
401 401
             $message = $message ?: $this->overrideError;
402 402
             $message = sprintf(
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                 $this->stringify($value2)
406 406
             );
407 407
 
408
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $fieldName, ['expected' => $value2]);
408
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $fieldName, [ 'expected' => $value2 ]);
409 409
         }
410 410
 
411 411
         return $this;
@@ -420,13 +420,13 @@  discard block
 block discarded – undo
420 420
      * @return Assert
421 421
      * @throws AssertionFailedException
422 422
      */
423
-    public function greaterThanOrEq($value2, string $message='', string $fieldName='')
423
+    public function greaterThanOrEq($value2, string $message = '', string $fieldName = '')
424 424
     {
425
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
425
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
426 426
         {
427 427
             return $this;
428 428
         }
429
-        if ( ! ( $this->value >= $value2 ) )
429
+        if ( ! ($this->value >= $value2))
430 430
         {
431 431
             $message = $message ?: $this->overrideError;
432 432
             $message = sprintf(
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
                 $this->stringify($value2)
436 436
             );
437 437
 
438
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $fieldName, ['expected' => $value2]);
438
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_EQ, $fieldName, [ 'expected' => $value2 ]);
439 439
         }
440 440
 
441 441
         return $this;
@@ -450,13 +450,13 @@  discard block
 block discarded – undo
450 450
      * @return Assert
451 451
      * @throws AssertionFailedException
452 452
      */
453
-    public function lessThan($value2, string $message='', string $fieldName='')
453
+    public function lessThan($value2, string $message = '', string $fieldName = '')
454 454
     {
455
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
455
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
456 456
         {
457 457
             return $this;
458 458
         }
459
-        if ( ! ( $this->value < $value2 ) )
459
+        if ( ! ($this->value < $value2))
460 460
         {
461 461
             $message = $message ?: $this->overrideError;
462 462
             $message = sprintf(
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
                 $this->stringify($value2)
466 466
             );
467 467
 
468
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN, $fieldName, ['expected' => $value2]);
468
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN, $fieldName, [ 'expected' => $value2 ]);
469 469
         }
470 470
 
471 471
         return $this;
@@ -480,13 +480,13 @@  discard block
 block discarded – undo
480 480
      * @return Assert
481 481
      * @throws AssertionFailedException
482 482
      */
483
-    public function lessThanOrEq($value2, string $message='', string $fieldName='')
483
+    public function lessThanOrEq($value2, string $message = '', string $fieldName = '')
484 484
     {
485
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
485
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
486 486
         {
487 487
             return $this;
488 488
         }
489
-        if ( ! ( $this->value <= $value2 ) )
489
+        if ( ! ($this->value <= $value2))
490 490
         {
491 491
             $message = $message ?: $this->overrideError;
492 492
             $message = sprintf(
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
                 $this->stringify($value2)
496 496
             );
497 497
 
498
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN_OR_EQ, $fieldName, ['expected' => $value2]);
498
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_LESS_THAN_OR_EQ, $fieldName, [ 'expected' => $value2 ]);
499 499
         }
500 500
 
501 501
         return $this;
@@ -510,13 +510,13 @@  discard block
 block discarded – undo
510 510
      * @return Assert
511 511
      * @throws AssertionFailedException
512 512
      */
513
-    public function same($value2, string $message='', string $fieldName='')
513
+    public function same($value2, string $message = '', string $fieldName = '')
514 514
     {
515
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
515
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
516 516
         {
517 517
             return $this;
518 518
         }
519
-        if ( $this->value !== $value2 )
519
+        if ($this->value !== $value2)
520 520
         {
521 521
             $message = $message ?: $this->overrideError;
522 522
             $message = sprintf(
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                 $this->stringify($value2)
526 526
             );
527 527
 
528
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_SAME, $fieldName, ['expected' => $value2]);
528
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_SAME, $fieldName, [ 'expected' => $value2 ]);
529 529
         }
530 530
 
531 531
         return $this;
@@ -540,13 +540,13 @@  discard block
 block discarded – undo
540 540
      * @return Assert
541 541
      * @throws AssertionFailedException
542 542
      */
543
-    public function notEq($value2, string $message='', string $fieldName='')
543
+    public function notEq($value2, string $message = '', string $fieldName = '')
544 544
     {
545
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
545
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
546 546
         {
547 547
             return $this;
548 548
         }
549
-        if ( $this->value == $value2 )
549
+        if ($this->value == $value2)
550 550
         {
551 551
             $message = $message ?: $this->overrideError;
552 552
             $message = sprintf(
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
                 $this->stringify($value2)
556 556
             );
557 557
 
558
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_EQ, $fieldName, ['expected' => $value2]);
558
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_EQ, $fieldName, [ 'expected' => $value2 ]);
559 559
         }
560 560
 
561 561
         return $this;
@@ -569,13 +569,13 @@  discard block
 block discarded – undo
569 569
      * @return $this
570 570
      * @throws AssertionFailedException
571 571
      */
572
-    public function isCallable(string $message='', string $fieldName='')
572
+    public function isCallable(string $message = '', string $fieldName = '')
573 573
     {
574
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
574
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
575 575
         {
576 576
             return $this;
577 577
         }
578
-        if ( !is_callable($this->value) )
578
+        if ( ! is_callable($this->value))
579 579
         {
580 580
             $message = $message ?: $this->overrideError;
581 581
             $message = sprintf(
@@ -598,13 +598,13 @@  discard block
 block discarded – undo
598 598
      * @return Assert
599 599
      * @throws AssertionFailedException
600 600
      */
601
-    public function notSame($value2, string $message='', string $fieldName='')
601
+    public function notSame($value2, string $message = '', string $fieldName = '')
602 602
     {
603
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
603
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
604 604
         {
605 605
             return $this;
606 606
         }
607
-        if ( $this->value === $value2 )
607
+        if ($this->value === $value2)
608 608
         {
609 609
             $message = $message ?: $this->overrideError;
610 610
             $message = sprintf(
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
                 $this->stringify($value2)
614 614
             );
615 615
 
616
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_SAME, $fieldName, ['expected' => $value2]);
616
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_SAME, $fieldName, [ 'expected' => $value2 ]);
617 617
         }
618 618
 
619 619
         return $this;
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
      * @return Assert
628 628
      * @throws AssertionFailedException
629 629
      */
630
-    public function id(string $message='', string $fieldName='')
630
+    public function id(string $message = '', string $fieldName = '')
631 631
     {
632 632
         $message = $message ?: $this->overrideError;
633 633
         $message = $message ?: 'Value "%s" is not an integer id.';
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
      * @return Assert
643 643
      * @throws AssertionFailedException
644 644
      */
645
-    public function unsignedInt($message=null, $fieldName=null)
645
+    public function unsignedInt($message = null, $fieldName = null)
646 646
     {
647 647
         $message = $message ?: $this->overrideError;
648 648
         $message = $message ?: 'Value "%s" is not an integer id.';
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
      * @return Assert
659 659
      * @throws AssertionFailedException
660 660
      */
661
-    public function flag(string $message='', string $fieldName='')
661
+    public function flag(string $message = '', string $fieldName = '')
662 662
     {
663 663
         $message = $message ?: $this->overrideError;
664 664
         $message = $message ?: 'Value "%s" is not a 0 or 1.';
@@ -674,12 +674,12 @@  discard block
 block discarded – undo
674 674
      * @return Assert
675 675
      * @throws AssertionFailedException
676 676
      */
677
-    public function status(string $message='', string $fieldName='')
677
+    public function status(string $message = '', string $fieldName = '')
678 678
     {
679 679
         $message = $message ?: $this->overrideError;
680 680
         $message = $message ?: 'Value "%s" is not a valid status.';
681 681
 
682
-        return $this->integer($message, $fieldName)->inArray([-1, 0, 1]);
682
+        return $this->integer($message, $fieldName)->inArray([-1, 0, 1 ]);
683 683
     }
684 684
 
685 685
     /**
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
      * @return Assert
691 691
      * @throws AssertionFailedException
692 692
      */
693
-    public function nullOrId(string $message='', string $fieldName='')
693
+    public function nullOrId(string $message = '', string $fieldName = '')
694 694
     {
695 695
         return $this->nullOr()->id($message, $fieldName);
696 696
     }
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
      * @return Assert
704 704
      * @throws AssertionFailedException
705 705
      */
706
-    public function allIds(string $message='', string $fieldName='')
706
+    public function allIds(string $message = '', string $fieldName = '')
707 707
     {
708 708
         return $this->all()->id($message, $fieldName);
709 709
     }
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
      * @return Assert
717 717
      * @throws AssertionFailedException
718 718
      */
719
-    public function int(string $message='', string $fieldName='')
719
+    public function int(string $message = '', string $fieldName = '')
720 720
     {
721 721
         return $this->integer($message, $fieldName);
722 722
     }
@@ -729,13 +729,13 @@  discard block
 block discarded – undo
729 729
      * @return Assert
730 730
      * @throws AssertionFailedException
731 731
      */
732
-    public function integer(string $message='', string $fieldName='')
732
+    public function integer(string $message = '', string $fieldName = '')
733 733
     {
734
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
734
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
735 735
         {
736 736
             return $this;
737 737
         }
738
-        if ( !is_int($this->value) )
738
+        if ( ! is_int($this->value))
739 739
         {
740 740
             $message = $message ?: $this->overrideError;
741 741
             $message = sprintf(
@@ -757,13 +757,13 @@  discard block
 block discarded – undo
757 757
      * @return Assert
758 758
      * @throws AssertionFailedException
759 759
      */
760
-    public function float(string $message='', string $fieldName='')
760
+    public function float(string $message = '', string $fieldName = '')
761 761
     {
762
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
762
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
763 763
         {
764 764
             return $this;
765 765
         }
766
-        if ( ! is_float($this->value) )
766
+        if ( ! is_float($this->value))
767 767
         {
768 768
             $message = $message ?: $this->overrideError;
769 769
             $message = sprintf(
@@ -785,13 +785,13 @@  discard block
 block discarded – undo
785 785
      * @return Assert
786 786
      * @throws AssertionFailedException
787 787
      */
788
-    public function digit(string $message='', string $fieldName='')
788
+    public function digit(string $message = '', string $fieldName = '')
789 789
     {
790
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
790
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
791 791
         {
792 792
             return $this;
793 793
         }
794
-        if ( ! ctype_digit((string)$this->value) )
794
+        if ( ! ctype_digit((string)$this->value))
795 795
         {
796 796
             $message = $message ?: $this->overrideError;
797 797
             $message = sprintf(
@@ -813,14 +813,14 @@  discard block
 block discarded – undo
813 813
      * @return Assert
814 814
      * @throws AssertionFailedException
815 815
      */
816
-    public function date(string $message='', string $fieldName='')
816
+    public function date(string $message = '', string $fieldName = '')
817 817
     {
818
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
818
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
819 819
         {
820 820
             return $this;
821 821
         }
822 822
         $this->notEmpty($message, $fieldName);
823
-        if ( strtotime($this->value) === false )
823
+        if (strtotime($this->value) === false)
824 824
         {
825 825
             $message = $message ?: $this->overrideError;
826 826
             $message = sprintf(
@@ -842,13 +842,13 @@  discard block
 block discarded – undo
842 842
      * @return Assert
843 843
      * @throws AssertionFailedException
844 844
      */
845
-    public function integerish(string $message='', string $fieldName='')
845
+    public function integerish(string $message = '', string $fieldName = '')
846 846
     {
847
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
847
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
848 848
         {
849 849
             return $this;
850 850
         }
851
-        if ( is_object($this->value) || strval(intval($this->value)) != $this->value || is_bool($this->value) || is_null($this->value) )
851
+        if (is_object($this->value) || strval(intval($this->value)) != $this->value || is_bool($this->value) || is_null($this->value))
852 852
         {
853 853
             $message = $message ?: $this->overrideError;
854 854
             $message = sprintf(
@@ -870,13 +870,13 @@  discard block
 block discarded – undo
870 870
      * @return Assert
871 871
      * @throws AssertionFailedException
872 872
      */
873
-    public function boolean(string $message='', string $fieldName='')
873
+    public function boolean(string $message = '', string $fieldName = '')
874 874
     {
875
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
875
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
876 876
         {
877 877
             return $this;
878 878
         }
879
-        if ( ! is_bool($this->value) )
879
+        if ( ! is_bool($this->value))
880 880
         {
881 881
             $message = $message ?: $this->overrideError;
882 882
             $message = sprintf(
@@ -898,13 +898,13 @@  discard block
 block discarded – undo
898 898
      * @return Assert
899 899
      * @throws AssertionFailedException
900 900
      */
901
-    public function scalar(string $message='', string $fieldName='')
901
+    public function scalar(string $message = '', string $fieldName = '')
902 902
     {
903
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
903
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
904 904
         {
905 905
             return $this;
906 906
         }
907
-        if ( ! is_scalar($this->value) )
907
+        if ( ! is_scalar($this->value))
908 908
         {
909 909
             $message = $message ?: $this->overrideError;
910 910
             $message = sprintf(
@@ -926,13 +926,13 @@  discard block
 block discarded – undo
926 926
      * @return Assert
927 927
      * @throws AssertionFailedException
928 928
      */
929
-    public function notEmpty(string $message='', string $fieldName='')
929
+    public function notEmpty(string $message = '', string $fieldName = '')
930 930
     {
931
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
931
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
932 932
         {
933 933
             return $this;
934 934
         }
935
-        if ( ( is_object($this->value) && empty((array)$this->value) ) || empty($this->value) )
935
+        if ((is_object($this->value) && empty((array)$this->value)) || empty($this->value))
936 936
         {
937 937
             $message = $message ?: $this->overrideError;
938 938
             $message = sprintf(
@@ -954,13 +954,13 @@  discard block
 block discarded – undo
954 954
      * @return Assert
955 955
      * @throws AssertionFailedException
956 956
      */
957
-    public function noContent(string $message='', string $fieldName='')
957
+    public function noContent(string $message = '', string $fieldName = '')
958 958
     {
959
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
959
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
960 960
         {
961 961
             return $this;
962 962
         }
963
-        if ( !empty( $this->value ) )
963
+        if ( ! empty($this->value))
964 964
         {
965 965
             $message = $message ?: $this->overrideError;
966 966
             $message = sprintf(
@@ -982,13 +982,13 @@  discard block
 block discarded – undo
982 982
      * @return Assert
983 983
      * @throws AssertionFailedException
984 984
      */
985
-    public function notNull(string $message='', string $fieldName='')
985
+    public function notNull(string $message = '', string $fieldName = '')
986 986
     {
987
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
987
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
988 988
         {
989 989
             return $this;
990 990
         }
991
-        if ( $this->value === null )
991
+        if ($this->value === null)
992 992
         {
993 993
             $message = $message ?: $this->overrideError;
994 994
             $message = sprintf(
@@ -1010,13 +1010,13 @@  discard block
 block discarded – undo
1010 1010
      * @return Assert
1011 1011
      * @throws AssertionFailedException
1012 1012
      */
1013
-    public function string(string $message='', string $fieldName='')
1013
+    public function string(string $message = '', string $fieldName = '')
1014 1014
     {
1015
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1015
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1016 1016
         {
1017 1017
             return $this;
1018 1018
         }
1019
-        if ( !is_string($this->value) )
1019
+        if ( ! is_string($this->value))
1020 1020
         {
1021 1021
             $message = $message ?: $this->overrideError;
1022 1022
             $message = sprintf(
@@ -1040,14 +1040,14 @@  discard block
 block discarded – undo
1040 1040
      * @return Assert
1041 1041
      * @throws AssertionFailedException
1042 1042
      */
1043
-    public function regex($pattern, $message=null, $fieldName=null)
1043
+    public function regex($pattern, $message = null, $fieldName = null)
1044 1044
     {
1045
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1045
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1046 1046
         {
1047 1047
             return $this;
1048 1048
         }
1049 1049
         $this->string($message, $fieldName);
1050
-        if ( ! preg_match($pattern, $this->value) )
1050
+        if ( ! preg_match($pattern, $this->value))
1051 1051
         {
1052 1052
             $message = $message ?: $this->overrideError;
1053 1053
             $message = sprintf(
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
                 $this->stringify($this->value)
1056 1056
             );
1057 1057
 
1058
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $fieldName, ['pattern' => $pattern]);
1058
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $fieldName, [ 'pattern' => $pattern ]);
1059 1059
         }
1060 1060
 
1061 1061
         return $this;
@@ -1069,15 +1069,15 @@  discard block
 block discarded – undo
1069 1069
      * @return $this
1070 1070
      * @throws AssertionFailedException
1071 1071
      */
1072
-    public function ipAddress(string $message='', string $fieldName='')
1072
+    public function ipAddress(string $message = '', string $fieldName = '')
1073 1073
     {
1074
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1074
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1075 1075
         {
1076 1076
             return $this;
1077 1077
         }
1078 1078
         $this->string($message, $fieldName);
1079
-        $pattern   = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/';
1080
-        if ( ! preg_match($pattern, $this->value) )
1079
+        $pattern = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/';
1080
+        if ( ! preg_match($pattern, $this->value))
1081 1081
         {
1082 1082
             $message = $message ?: $this->overrideError;
1083 1083
             $message = sprintf(
@@ -1100,14 +1100,14 @@  discard block
 block discarded – undo
1100 1100
      * @return $this
1101 1101
      * @throws AssertionFailedException
1102 1102
      */
1103
-    public function notRegex($pattern, string $message='', string $fieldName='')
1103
+    public function notRegex($pattern, string $message = '', string $fieldName = '')
1104 1104
     {
1105
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1105
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1106 1106
         {
1107 1107
             return $this;
1108 1108
         }
1109 1109
         $this->string($message, $fieldName);
1110
-        if ( preg_match($pattern, $this->value) )
1110
+        if (preg_match($pattern, $this->value))
1111 1111
         {
1112 1112
             $message = $message ?: $this->overrideError;
1113 1113
             $message = sprintf(
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
                 $this->stringify($this->value)
1116 1116
             );
1117 1117
 
1118
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $fieldName, ['pattern' => $pattern]);
1118
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_REGEX, $fieldName, [ 'pattern' => $pattern ]);
1119 1119
         }
1120 1120
 
1121 1121
         return $this;
@@ -1131,14 +1131,14 @@  discard block
 block discarded – undo
1131 1131
      * @return Assert
1132 1132
      * @throws AssertionFailedException
1133 1133
      */
1134
-    public function length($length, string $message='', string $fieldName='', $encoding = 'utf8')
1134
+    public function length($length, string $message = '', string $fieldName = '', $encoding = 'utf8')
1135 1135
     {
1136
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1136
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1137 1137
         {
1138 1138
             return $this;
1139 1139
         }
1140 1140
         $this->string($message, $fieldName);
1141
-        if ( mb_strlen($this->value, $encoding) !== $length )
1141
+        if (mb_strlen($this->value, $encoding) !== $length)
1142 1142
         {
1143 1143
             $message    = $message ?: $this->overrideError;
1144 1144
             $message    = sprintf(
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
                 $length,
1148 1148
                 mb_strlen($this->value, $encoding)
1149 1149
             );
1150
-            $constraints = ['length' => $length, 'encoding' => $encoding];
1150
+            $constraints = [ 'length' => $length, 'encoding' => $encoding ];
1151 1151
 
1152 1152
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_LENGTH, $fieldName, $constraints);
1153 1153
         }
@@ -1166,24 +1166,24 @@  discard block
 block discarded – undo
1166 1166
      * @return Assert
1167 1167
      * @throws AssertionFailedException
1168 1168
      */
1169
-    public function minLength($minLength, string $message='', string $fieldName='', $encoding = 'utf8')
1169
+    public function minLength($minLength, string $message = '', string $fieldName = '', $encoding = 'utf8')
1170 1170
     {
1171
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1171
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1172 1172
         {
1173 1173
             return $this;
1174 1174
         }
1175 1175
         $this->string($message, $fieldName);
1176
-        if ( mb_strlen($this->value, $encoding) < $minLength )
1176
+        if (mb_strlen($this->value, $encoding) < $minLength)
1177 1177
         {
1178 1178
             $message = $message ?: $this->overrideError;
1179
-            $message     = sprintf(
1179
+            $message = sprintf(
1180 1180
                 $message
1181 1181
                     ?: 'Value "%s" is too short, it should have more than %d characters, but only has %d characters.',
1182 1182
                 $this->stringify($this->value),
1183 1183
                 $minLength,
1184 1184
                 mb_strlen($this->value, $encoding)
1185 1185
             );
1186
-            $constraints = ['min_length' => $minLength, 'encoding' => $encoding];
1186
+            $constraints = [ 'min_length' => $minLength, 'encoding' => $encoding ];
1187 1187
 
1188 1188
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN_LENGTH, $fieldName, $constraints);
1189 1189
         }
@@ -1202,23 +1202,23 @@  discard block
 block discarded – undo
1202 1202
      * @return Assert
1203 1203
      * @throws AssertionFailedException
1204 1204
      */
1205
-    public function maxLength($maxLength, string $message='', string $fieldName='', $encoding = 'utf8')
1205
+    public function maxLength($maxLength, string $message = '', string $fieldName = '', $encoding = 'utf8')
1206 1206
     {
1207
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1207
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1208 1208
         {
1209 1209
             return $this;
1210 1210
         }
1211 1211
         $this->string($message, $fieldName);
1212
-        if ( mb_strlen($this->value, $encoding) > $maxLength )
1212
+        if (mb_strlen($this->value, $encoding) > $maxLength)
1213 1213
         {
1214 1214
             $message = $message ?: $this->overrideError;
1215
-            $message     = sprintf(
1215
+            $message = sprintf(
1216 1216
                 $message ?: 'Value "%s" is too long, it should have no more than %d characters, but has %d characters.',
1217 1217
                 $this->stringify($this->value),
1218 1218
                 $maxLength,
1219 1219
                 mb_strlen($this->value, $encoding)
1220 1220
             );
1221
-            $constraints = ['max_length' => $maxLength, 'encoding' => $encoding];
1221
+            $constraints = [ 'max_length' => $maxLength, 'encoding' => $encoding ];
1222 1222
 
1223 1223
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX_LENGTH, $fieldName, $constraints);
1224 1224
         }
@@ -1237,37 +1237,37 @@  discard block
 block discarded – undo
1237 1237
      * @return Assert
1238 1238
      * @throws AssertionFailedException
1239 1239
      */
1240
-    public function betweenLength($minLength, $maxLength, string $message='', string $fieldName='', $encoding = 'utf8')
1240
+    public function betweenLength($minLength, $maxLength, string $message = '', string $fieldName = '', $encoding = 'utf8')
1241 1241
     {
1242
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1242
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1243 1243
         {
1244 1244
             return $this;
1245 1245
         }
1246 1246
         $this->string($message, $fieldName);
1247
-        if ( mb_strlen($this->value, $encoding) < $minLength )
1247
+        if (mb_strlen($this->value, $encoding) < $minLength)
1248 1248
         {
1249 1249
             $message = $message ?: $this->overrideError;
1250
-            $message     = sprintf(
1250
+            $message = sprintf(
1251 1251
                 $message
1252 1252
                     ?: 'Value "%s" is too short, it should have more than %d characters, but only has %d characters.',
1253 1253
                 $this->stringify($this->value),
1254 1254
                 $minLength,
1255 1255
                 mb_strlen($this->value, $encoding)
1256 1256
             );
1257
-            $constraints = ['min_length' => $minLength, 'encoding' => $encoding];
1257
+            $constraints = [ 'min_length' => $minLength, 'encoding' => $encoding ];
1258 1258
 
1259 1259
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN_LENGTH, $fieldName, $constraints);
1260 1260
         }
1261
-        if ( mb_strlen($this->value, $encoding) > $maxLength )
1261
+        if (mb_strlen($this->value, $encoding) > $maxLength)
1262 1262
         {
1263 1263
             $message = $message ?: $this->overrideError;
1264
-            $message     = sprintf(
1264
+            $message = sprintf(
1265 1265
                 $message ?: 'Value "%s" is too long, it should have no more than %d characters, but has %d characters.',
1266 1266
                 $this->stringify($this->value),
1267 1267
                 $maxLength,
1268 1268
                 mb_strlen($this->value, $encoding)
1269 1269
             );
1270
-            $constraints = ['max_length' => $maxLength, 'encoding' => $encoding];
1270
+            $constraints = [ 'max_length' => $maxLength, 'encoding' => $encoding ];
1271 1271
 
1272 1272
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX_LENGTH, $fieldName, $constraints);
1273 1273
         }
@@ -1285,22 +1285,22 @@  discard block
 block discarded – undo
1285 1285
      * @return Assert
1286 1286
      * @throws AssertionFailedException
1287 1287
      */
1288
-    public function startsWith($needle, string $message='', string $fieldName='', $encoding = 'utf8')
1288
+    public function startsWith($needle, string $message = '', string $fieldName = '', $encoding = 'utf8')
1289 1289
     {
1290
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1290
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1291 1291
         {
1292 1292
             return $this;
1293 1293
         }
1294 1294
         $this->string($message, $fieldName);
1295
-        if ( mb_strpos($this->value, $needle, 0, $encoding) !== 0 )
1295
+        if (mb_strpos($this->value, $needle, 0, $encoding) !== 0)
1296 1296
         {
1297 1297
             $message = $message ?: $this->overrideError;
1298
-            $message     = sprintf(
1298
+            $message = sprintf(
1299 1299
                 $message ?: 'Value "%s" does not start with "%s".',
1300 1300
                 $this->stringify($this->value),
1301 1301
                 $this->stringify($needle)
1302 1302
             );
1303
-            $constraints = ['needle' => $needle, 'encoding' => $encoding];
1303
+            $constraints = [ 'needle' => $needle, 'encoding' => $encoding ];
1304 1304
 
1305 1305
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_START, $fieldName, $constraints);
1306 1306
         }
@@ -1318,23 +1318,23 @@  discard block
 block discarded – undo
1318 1318
      * @return Assert
1319 1319
      * @throws AssertionFailedException
1320 1320
      */
1321
-    public function endsWith($needle, string $message='', string $fieldName='', $encoding = 'utf8')
1321
+    public function endsWith($needle, string $message = '', string $fieldName = '', $encoding = 'utf8')
1322 1322
     {
1323
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1323
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1324 1324
         {
1325 1325
             return $this;
1326 1326
         }
1327 1327
         $this->string($message, $fieldName);
1328 1328
         $stringPosition = mb_strlen($this->value, $encoding) - mb_strlen($needle, $encoding);
1329
-        if ( mb_strripos($this->value, $needle, 0 , $encoding) !== $stringPosition )
1329
+        if (mb_strripos($this->value, $needle, 0, $encoding) !== $stringPosition)
1330 1330
         {
1331 1331
             $message = $message ?: $this->overrideError;
1332
-            $message     = sprintf(
1332
+            $message = sprintf(
1333 1333
                 $message ?: 'Value "%s" does not end with "%s".',
1334 1334
                 $this->stringify($this->value),
1335 1335
                 $this->stringify($needle)
1336 1336
             );
1337
-            $constraints = ['needle' => $needle, 'encoding' => $encoding];
1337
+            $constraints = [ 'needle' => $needle, 'encoding' => $encoding ];
1338 1338
 
1339 1339
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_END, $fieldName, $constraints);
1340 1340
         }
@@ -1352,22 +1352,22 @@  discard block
 block discarded – undo
1352 1352
      * @return Assert
1353 1353
      * @throws AssertionFailedException
1354 1354
      */
1355
-    public function contains($needle, string $message='', string $fieldName='', $encoding = 'utf8')
1355
+    public function contains($needle, string $message = '', string $fieldName = '', $encoding = 'utf8')
1356 1356
     {
1357
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1357
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1358 1358
         {
1359 1359
             return $this;
1360 1360
         }
1361 1361
         $this->string($message, $fieldName);
1362
-        if ( mb_strpos($this->value, $needle, 0, $encoding) === false )
1362
+        if (mb_strpos($this->value, $needle, 0, $encoding) === false)
1363 1363
         {
1364 1364
             $message = $message ?: $this->overrideError;
1365
-            $message     = sprintf(
1365
+            $message = sprintf(
1366 1366
                 $message ?: 'Value "%s" does not contain "%s".',
1367 1367
                 $this->stringify($this->value),
1368 1368
                 $this->stringify($needle)
1369 1369
             );
1370
-            $constraints = ['needle' => $needle, 'encoding' => $encoding];
1370
+            $constraints = [ 'needle' => $needle, 'encoding' => $encoding ];
1371 1371
 
1372 1372
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_STRING_CONTAINS, $fieldName, $constraints);
1373 1373
         }
@@ -1384,13 +1384,13 @@  discard block
 block discarded – undo
1384 1384
      * @return Assert
1385 1385
      * @throws AssertionFailedException
1386 1386
      */
1387
-    public function choice(array $choices, string $message='', string $fieldName='')
1387
+    public function choice(array $choices, string $message = '', string $fieldName = '')
1388 1388
     {
1389
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1389
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1390 1390
         {
1391 1391
             return $this;
1392 1392
         }
1393
-        if ( !in_array($this->value, $choices, true) )
1393
+        if ( ! in_array($this->value, $choices, true))
1394 1394
         {
1395 1395
             $message = $message ?: $this->overrideError;
1396 1396
             $message = sprintf(
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
                 implode(", ", array_map('Terah\Assert\Assert::stringify', $choices))
1400 1400
             );
1401 1401
 
1402
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_CHOICE, $fieldName, ['choices' => $choices]);
1402
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_CHOICE, $fieldName, [ 'choices' => $choices ]);
1403 1403
         }
1404 1404
 
1405 1405
         return $this;
@@ -1414,9 +1414,9 @@  discard block
 block discarded – undo
1414 1414
      * @return Assert
1415 1415
      * @throws AssertionFailedException
1416 1416
      */
1417
-    public function inArray(array $choices, string $message='', string $fieldName='')
1417
+    public function inArray(array $choices, string $message = '', string $fieldName = '')
1418 1418
     {
1419
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1419
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1420 1420
         {
1421 1421
             return $this;
1422 1422
         }
@@ -1433,13 +1433,13 @@  discard block
 block discarded – undo
1433 1433
      * @return Assert
1434 1434
      * @throws AssertionFailedException
1435 1435
      */
1436
-    public function numeric(string $message='', string $fieldName='')
1436
+    public function numeric(string $message = '', string $fieldName = '')
1437 1437
     {
1438
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1438
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1439 1439
         {
1440 1440
             return $this;
1441 1441
         }
1442
-        if ( ! is_numeric($this->value) )
1442
+        if ( ! is_numeric($this->value))
1443 1443
         {
1444 1444
             $message = $message ?: $this->overrideError;
1445 1445
             $message = sprintf(
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
      * @return Assert
1462 1462
      * @throws AssertionFailedException
1463 1463
      */
1464
-    public function nonEmptyArray(string $message='', string $fieldName='')
1464
+    public function nonEmptyArray(string $message = '', string $fieldName = '')
1465 1465
     {
1466 1466
         $message = $message ?: 'Value "%s" is not a non-empty array.';
1467 1467
 
@@ -1476,7 +1476,7 @@  discard block
 block discarded – undo
1476 1476
      * @return Assert
1477 1477
      * @throws AssertionFailedException
1478 1478
      */
1479
-    public function nonEmptyInt(string $message='', string $fieldName='')
1479
+    public function nonEmptyInt(string $message = '', string $fieldName = '')
1480 1480
     {
1481 1481
         $message = $message ?: 'Value "%s" is not a non-empty integer.';
1482 1482
 
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
      * @return Assert
1492 1492
      * @throws AssertionFailedException
1493 1493
      */
1494
-    public function nonEmptyString(string $message='', string $fieldName='')
1494
+    public function nonEmptyString(string $message = '', string $fieldName = '')
1495 1495
     {
1496 1496
         $message = $message ?: 'Value "%s" is not a non-empty string.';
1497 1497
 
@@ -1506,13 +1506,13 @@  discard block
 block discarded – undo
1506 1506
      * @return Assert
1507 1507
      * @throws AssertionFailedException
1508 1508
      */
1509
-    public function isArray(string $message='', string $fieldName='')
1509
+    public function isArray(string $message = '', string $fieldName = '')
1510 1510
     {
1511
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1511
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1512 1512
         {
1513 1513
             return $this;
1514 1514
         }
1515
-        if ( !is_array($this->value) )
1515
+        if ( ! is_array($this->value))
1516 1516
         {
1517 1517
             $message = $message ?: $this->overrideError;
1518 1518
             $message = sprintf(
@@ -1534,13 +1534,13 @@  discard block
 block discarded – undo
1534 1534
      * @return Assert
1535 1535
      * @throws AssertionFailedException
1536 1536
      */
1537
-    public function isTraversable(string $message='', string $fieldName='')
1537
+    public function isTraversable(string $message = '', string $fieldName = '')
1538 1538
     {
1539
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1539
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1540 1540
         {
1541 1541
             return $this;
1542 1542
         }
1543
-        if ( !is_array($this->value) && !$this->value instanceof \Traversable )
1543
+        if ( ! is_array($this->value) && ! $this->value instanceof \Traversable)
1544 1544
         {
1545 1545
             $message = $message ?: $this->overrideError;
1546 1546
             $message = sprintf(
@@ -1562,13 +1562,13 @@  discard block
 block discarded – undo
1562 1562
      * @return Assert
1563 1563
      * @throws AssertionFailedException
1564 1564
      */
1565
-    public function isArrayAccessible(string $message='', string $fieldName='')
1565
+    public function isArrayAccessible(string $message = '', string $fieldName = '')
1566 1566
     {
1567
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1567
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1568 1568
         {
1569 1569
             return $this;
1570 1570
         }
1571
-        if ( !is_array($this->value) && !$this->value instanceof \ArrayAccess )
1571
+        if ( ! is_array($this->value) && ! $this->value instanceof \ArrayAccess)
1572 1572
         {
1573 1573
             $message = $message ?: $this->overrideError;
1574 1574
             $message = sprintf(
@@ -1591,14 +1591,14 @@  discard block
 block discarded – undo
1591 1591
      * @return Assert
1592 1592
      * @throws AssertionFailedException
1593 1593
      */
1594
-    public function keyExists($key, string $message='', string $fieldName='')
1594
+    public function keyExists($key, string $message = '', string $fieldName = '')
1595 1595
     {
1596
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1596
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1597 1597
         {
1598 1598
             return $this;
1599 1599
         }
1600 1600
         $this->isArray($message, $fieldName);
1601
-        if ( !array_key_exists($key, $this->value) )
1601
+        if ( ! array_key_exists($key, $this->value))
1602 1602
         {
1603 1603
             $message = $message ?: $this->overrideError;
1604 1604
             $message = sprintf(
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
                 $this->stringify($key)
1607 1607
             );
1608 1608
 
1609
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_EXISTS, $fieldName, ['key' => $key]);
1609
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_EXISTS, $fieldName, [ 'key' => $key ]);
1610 1610
         }
1611 1611
 
1612 1612
         return $this;
@@ -1621,23 +1621,23 @@  discard block
 block discarded – undo
1621 1621
      * @return Assert
1622 1622
      * @throws AssertionFailedException
1623 1623
      */
1624
-    public function keysExist($keys, string $message='', string $fieldName='')
1624
+    public function keysExist($keys, string $message = '', string $fieldName = '')
1625 1625
     {
1626
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1626
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1627 1627
         {
1628 1628
             return $this;
1629 1629
         }
1630 1630
         $this->isArray($message, $fieldName);
1631
-        foreach ( $keys as $key )
1631
+        foreach ($keys as $key)
1632 1632
         {
1633
-            if ( !array_key_exists($key, $this->value) )
1633
+            if ( ! array_key_exists($key, $this->value))
1634 1634
             {
1635 1635
                 $message = $message
1636 1636
                     ?: sprintf(
1637 1637
                         'Array does not contain an element with key "%s"',
1638 1638
                         $this->stringify($key)
1639 1639
                     );
1640
-                throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEYS_EXIST, $fieldName, ['key' => $key]);
1640
+                throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEYS_EXIST, $fieldName, [ 'key' => $key ]);
1641 1641
             }
1642 1642
         }
1643 1643
 
@@ -1653,14 +1653,14 @@  discard block
 block discarded – undo
1653 1653
      * @return Assert
1654 1654
      * @throws AssertionFailedException
1655 1655
      */
1656
-    public function propertyExists($key, string $message='', string $fieldName='')
1656
+    public function propertyExists($key, string $message = '', string $fieldName = '')
1657 1657
     {
1658
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1658
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1659 1659
         {
1660 1660
             return $this;
1661 1661
         }
1662 1662
         $this->isObject($message, $fieldName);
1663
-        if ( !property_exists($this->value, $key) && !isset( $this->value->{$key} ) )
1663
+        if ( ! property_exists($this->value, $key) && ! isset($this->value->{$key} ))
1664 1664
         {
1665 1665
             $message = $message
1666 1666
                 ?: sprintf(
@@ -1668,7 +1668,7 @@  discard block
 block discarded – undo
1668 1668
                     $this->stringify($key)
1669 1669
                 );
1670 1670
 
1671
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTY_EXISTS, $fieldName, ['key' => $key]);
1671
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTY_EXISTS, $fieldName, [ 'key' => $key ]);
1672 1672
         }
1673 1673
 
1674 1674
         return $this;
@@ -1683,24 +1683,24 @@  discard block
 block discarded – undo
1683 1683
      * @return Assert
1684 1684
      * @throws AssertionFailedException
1685 1685
      */
1686
-    public function propertiesExist(array $keys, string $message='', string $fieldName='')
1686
+    public function propertiesExist(array $keys, string $message = '', string $fieldName = '')
1687 1687
     {
1688
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1688
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1689 1689
         {
1690 1690
             return $this;
1691 1691
         }
1692 1692
         $this->isObject($message, $fieldName);
1693
-        foreach ( $keys as $key )
1693
+        foreach ($keys as $key)
1694 1694
         {
1695 1695
             // Using isset to allow resolution of magically defined properties
1696
-            if ( !property_exists($this->value, $key) && !isset( $this->value->{$key} ) )
1696
+            if ( ! property_exists($this->value, $key) && ! isset($this->value->{$key} ))
1697 1697
             {
1698 1698
                 $message = $message
1699 1699
                     ?: sprintf(
1700 1700
                         'Object does not contain a property with key "%s"',
1701 1701
                         $this->stringify($key)
1702 1702
                     );
1703
-                throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTIES_EXIST, $fieldName, ['key' => $key]);
1703
+                throw $this->createException($message, $this->overrideCode ?: self::INVALID_PROPERTIES_EXIST, $fieldName, [ 'key' => $key ]);
1704 1704
             }
1705 1705
         }
1706 1706
 
@@ -1715,14 +1715,14 @@  discard block
 block discarded – undo
1715 1715
      * @return Assert
1716 1716
      * @throws AssertionFailedException
1717 1717
      */
1718
-    public function utf8(string $message='', string $fieldName='')
1718
+    public function utf8(string $message = '', string $fieldName = '')
1719 1719
     {
1720
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1720
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1721 1721
         {
1722 1722
             return $this;
1723 1723
         }
1724 1724
         $this->string($message, $fieldName);
1725
-        if ( mb_detect_encoding($this->value, 'UTF-8', true) !== 'UTF-8' )
1725
+        if (mb_detect_encoding($this->value, 'UTF-8', true) !== 'UTF-8')
1726 1726
         {
1727 1727
             $message = $message
1728 1728
                 ?: sprintf(
@@ -1745,14 +1745,14 @@  discard block
 block discarded – undo
1745 1745
      * @return Assert
1746 1746
      * @throws AssertionFailedException
1747 1747
      */
1748
-    public function ascii(string $message='', string $fieldName='')
1748
+    public function ascii(string $message = '', string $fieldName = '')
1749 1749
     {
1750
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1750
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1751 1751
         {
1752 1752
             return $this;
1753 1753
         }
1754 1754
         $this->string($message, $fieldName);
1755
-        if ( ! preg_match('/^[ -~]+$/', $this->value) )
1755
+        if ( ! preg_match('/^[ -~]+$/', $this->value))
1756 1756
         {
1757 1757
             $message = $message
1758 1758
                 ?: sprintf(
@@ -1776,14 +1776,14 @@  discard block
 block discarded – undo
1776 1776
      * @return Assert
1777 1777
      * @throws AssertionFailedException
1778 1778
      */
1779
-    public function keyIsset($key, string $message='', string $fieldName='')
1779
+    public function keyIsset($key, string $message = '', string $fieldName = '')
1780 1780
     {
1781
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1781
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1782 1782
         {
1783 1783
             return $this;
1784 1784
         }
1785 1785
         $this->isArrayAccessible($message, $fieldName);
1786
-        if ( !isset( $this->value[$key] ) )
1786
+        if ( ! isset($this->value[ $key ]))
1787 1787
         {
1788 1788
             $message = $message ?: $this->overrideError;
1789 1789
             $message = sprintf(
@@ -1791,7 +1791,7 @@  discard block
 block discarded – undo
1791 1791
                 $this->stringify($key)
1792 1792
             );
1793 1793
 
1794
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_ISSET, $fieldName, ['key' => $key]);
1794
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_KEY_ISSET, $fieldName, [ 'key' => $key ]);
1795 1795
         }
1796 1796
 
1797 1797
         return $this;
@@ -1807,14 +1807,14 @@  discard block
 block discarded – undo
1807 1807
      * @return Assert
1808 1808
      * @throws AssertionFailedException
1809 1809
      */
1810
-    public function notEmptyKey($key, string $message='', string $fieldName='')
1810
+    public function notEmptyKey($key, string $message = '', string $fieldName = '')
1811 1811
     {
1812
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1812
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1813 1813
         {
1814 1814
             return $this;
1815 1815
         }
1816 1816
         $this->keyIsset($key, $message, $fieldName);
1817
-        (new Assert($this->value[$key]))->setExceptionClass($this->exceptionClass)->notEmpty($message, $fieldName);
1817
+        (new Assert($this->value[ $key ]))->setExceptionClass($this->exceptionClass)->notEmpty($message, $fieldName);
1818 1818
 
1819 1819
         return $this;
1820 1820
     }
@@ -1827,13 +1827,13 @@  discard block
 block discarded – undo
1827 1827
      * @return Assert
1828 1828
      * @throws AssertionFailedException
1829 1829
      */
1830
-    public function notBlank(string $message='', string $fieldName='')
1830
+    public function notBlank(string $message = '', string $fieldName = '')
1831 1831
     {
1832
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1832
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1833 1833
         {
1834 1834
             return $this;
1835 1835
         }
1836
-        if ( false === $this->value || ( empty( $this->value ) && '0' != $this->value ) )
1836
+        if (false === $this->value || (empty($this->value) && '0' != $this->value))
1837 1837
         {
1838 1838
             $message = $message ?: $this->overrideError;
1839 1839
             $message = sprintf(
@@ -1856,13 +1856,13 @@  discard block
 block discarded – undo
1856 1856
      * @return Assert
1857 1857
      * @throws AssertionFailedException
1858 1858
      */
1859
-    public function isInstanceOf($className, string $message='', string $fieldName='')
1859
+    public function isInstanceOf($className, string $message = '', string $fieldName = '')
1860 1860
     {
1861
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1861
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1862 1862
         {
1863 1863
             return $this;
1864 1864
         }
1865
-        if ( !( $this->value instanceof $className ) )
1865
+        if ( ! ($this->value instanceof $className))
1866 1866
         {
1867 1867
             $message = $message ?: $this->overrideError;
1868 1868
             $message = sprintf(
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
                 $className
1872 1872
             );
1873 1873
 
1874
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_INSTANCE_OF, $fieldName, ['class' => $className]);
1874
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_INSTANCE_OF, $fieldName, [ 'class' => $className ]);
1875 1875
         }
1876 1876
 
1877 1877
         return $this;
@@ -1886,13 +1886,13 @@  discard block
 block discarded – undo
1886 1886
      * @return Assert
1887 1887
      * @throws AssertionFailedException
1888 1888
      */
1889
-    public function notIsInstanceOf($className, string $message='', string $fieldName='')
1889
+    public function notIsInstanceOf($className, string $message = '', string $fieldName = '')
1890 1890
     {
1891
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1891
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1892 1892
         {
1893 1893
             return $this;
1894 1894
         }
1895
-        if ( $this->value instanceof $className )
1895
+        if ($this->value instanceof $className)
1896 1896
         {
1897 1897
             $message = $message ?: $this->overrideError;
1898 1898
             $message = sprintf(
@@ -1901,7 +1901,7 @@  discard block
 block discarded – undo
1901 1901
                 $className
1902 1902
             );
1903 1903
 
1904
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_INSTANCE_OF, $fieldName, ['class' => $className]);
1904
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_INSTANCE_OF, $fieldName, [ 'class' => $className ]);
1905 1905
         }
1906 1906
 
1907 1907
         return $this;
@@ -1916,13 +1916,13 @@  discard block
 block discarded – undo
1916 1916
      * @return Assert
1917 1917
      * @throws AssertionFailedException
1918 1918
      */
1919
-    public function subclassOf($className, string $message='', string $fieldName='')
1919
+    public function subclassOf($className, string $message = '', string $fieldName = '')
1920 1920
     {
1921
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1921
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1922 1922
         {
1923 1923
             return $this;
1924 1924
         }
1925
-        if ( !is_subclass_of($this->value, $className) )
1925
+        if ( ! is_subclass_of($this->value, $className))
1926 1926
         {
1927 1927
             $message = $message ?: $this->overrideError;
1928 1928
             $message = sprintf(
@@ -1931,7 +1931,7 @@  discard block
 block discarded – undo
1931 1931
                 $className
1932 1932
             );
1933 1933
 
1934
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_SUBCLASS_OF, $fieldName, ['class' => $className]);
1934
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_SUBCLASS_OF, $fieldName, [ 'class' => $className ]);
1935 1935
         }
1936 1936
 
1937 1937
         return $this;
@@ -1947,14 +1947,14 @@  discard block
 block discarded – undo
1947 1947
      * @return Assert
1948 1948
      * @throws AssertionFailedException
1949 1949
      */
1950
-    public function range($minValue, $maxValue, string $message='', string $fieldName='')
1950
+    public function range($minValue, $maxValue, string $message = '', string $fieldName = '')
1951 1951
     {
1952
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1952
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1953 1953
         {
1954 1954
             return $this;
1955 1955
         }
1956 1956
         $this->numeric($message, $fieldName);
1957
-        if ( $this->value < $minValue || $this->value > $maxValue )
1957
+        if ($this->value < $minValue || $this->value > $maxValue)
1958 1958
         {
1959 1959
             $message = $message ?: $this->overrideError;
1960 1960
             $message = sprintf(
@@ -1982,14 +1982,14 @@  discard block
 block discarded – undo
1982 1982
      * @return Assert
1983 1983
      * @throws AssertionFailedException
1984 1984
      */
1985
-    public function min($minValue, string $message='', string $fieldName='')
1985
+    public function min($minValue, string $message = '', string $fieldName = '')
1986 1986
     {
1987
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1987
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
1988 1988
         {
1989 1989
             return $this;
1990 1990
         }
1991 1991
         $this->numeric($message, $fieldName);
1992
-        if ( $this->value < $minValue )
1992
+        if ($this->value < $minValue)
1993 1993
         {
1994 1994
             $message = $message ?: $this->overrideError;
1995 1995
             $message = sprintf(
@@ -1998,7 +1998,7 @@  discard block
 block discarded – undo
1998 1998
                 $this->stringify($minValue)
1999 1999
             );
2000 2000
 
2001
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN, $fieldName, ['min' => $minValue]);
2001
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_MIN, $fieldName, [ 'min' => $minValue ]);
2002 2002
         }
2003 2003
 
2004 2004
         return $this;
@@ -2013,14 +2013,14 @@  discard block
 block discarded – undo
2013 2013
      * @return Assert
2014 2014
      * @throws AssertionFailedException
2015 2015
      */
2016
-    public function max($maxValue, string $message='', string $fieldName='')
2016
+    public function max($maxValue, string $message = '', string $fieldName = '')
2017 2017
     {
2018
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2018
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2019 2019
         {
2020 2020
             return $this;
2021 2021
         }
2022 2022
         $this->numeric($message, $fieldName);
2023
-        if ( $this->value > $maxValue )
2023
+        if ($this->value > $maxValue)
2024 2024
         {
2025 2025
             $message = $message ?: $this->overrideError;
2026 2026
             $message = sprintf(
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
                 $this->stringify($maxValue)
2030 2030
             );
2031 2031
 
2032
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX, $fieldName, ['max' => $maxValue]);
2032
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_MAX, $fieldName, [ 'max' => $maxValue ]);
2033 2033
         }
2034 2034
 
2035 2035
         return $this;
@@ -2043,15 +2043,15 @@  discard block
 block discarded – undo
2043 2043
      * @return Assert
2044 2044
      * @throws AssertionFailedException
2045 2045
      */
2046
-    public function file(string $message='', string $fieldName='')
2046
+    public function file(string $message = '', string $fieldName = '')
2047 2047
     {
2048
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2048
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2049 2049
         {
2050 2050
             return $this;
2051 2051
         }
2052 2052
         $this->string($message, $fieldName);
2053 2053
         $this->notEmpty($message, $fieldName);
2054
-        if ( !is_file($this->value) )
2054
+        if ( ! is_file($this->value))
2055 2055
         {
2056 2056
             $message = $message ?: $this->overrideError;
2057 2057
             $message = sprintf(
@@ -2073,15 +2073,15 @@  discard block
 block discarded – undo
2073 2073
      * @return $this
2074 2074
      * @throws AssertionFailedException
2075 2075
      */
2076
-    public function fileOrDirectoryExists(string $message='', string $fieldName='')
2076
+    public function fileOrDirectoryExists(string $message = '', string $fieldName = '')
2077 2077
     {
2078
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2078
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2079 2079
         {
2080 2080
             return $this;
2081 2081
         }
2082 2082
         $this->string($message, $fieldName);
2083 2083
         $this->notEmpty($message, $fieldName);
2084
-        if ( ! file_exists($this->value) )
2084
+        if ( ! file_exists($this->value))
2085 2085
         {
2086 2086
             $message = $message ?: $this->overrideError;
2087 2087
             $message = sprintf(
@@ -2103,14 +2103,14 @@  discard block
 block discarded – undo
2103 2103
      * @return Assert
2104 2104
      * @throws AssertionFailedException
2105 2105
      */
2106
-    public function directory(string $message='', string $fieldName='')
2106
+    public function directory(string $message = '', string $fieldName = '')
2107 2107
     {
2108
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2108
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2109 2109
         {
2110 2110
             return $this;
2111 2111
         }
2112 2112
         $this->string($message, $fieldName);
2113
-        if ( !is_dir($this->value) )
2113
+        if ( ! is_dir($this->value))
2114 2114
         {
2115 2115
             $message = $message ?: $this->overrideError;
2116 2116
             $message = sprintf(
@@ -2132,14 +2132,14 @@  discard block
 block discarded – undo
2132 2132
      * @return Assert
2133 2133
      * @throws AssertionFailedException
2134 2134
      */
2135
-    public function readable(string $message='', string $fieldName='')
2135
+    public function readable(string $message = '', string $fieldName = '')
2136 2136
     {
2137
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2137
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2138 2138
         {
2139 2139
             return $this;
2140 2140
         }
2141 2141
         $this->string($message, $fieldName);
2142
-        if ( !is_readable($this->value) )
2142
+        if ( ! is_readable($this->value))
2143 2143
         {
2144 2144
             $message = $message ?: $this->overrideError;
2145 2145
             $message = sprintf(
@@ -2161,14 +2161,14 @@  discard block
 block discarded – undo
2161 2161
      * @return Assert
2162 2162
      * @throws AssertionFailedException
2163 2163
      */
2164
-    public function writeable(string $message='', string $fieldName='')
2164
+    public function writeable(string $message = '', string $fieldName = '')
2165 2165
     {
2166
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2166
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2167 2167
         {
2168 2168
             return $this;
2169 2169
         }
2170 2170
         $this->string($message, $fieldName);
2171
-        if ( !is_writeable($this->value) )
2171
+        if ( ! is_writeable($this->value))
2172 2172
         {
2173 2173
             $message = $message ?: $this->overrideError;
2174 2174
             $message = sprintf(
@@ -2190,14 +2190,14 @@  discard block
 block discarded – undo
2190 2190
      * @return Assert
2191 2191
      * @throws AssertionFailedException
2192 2192
      */
2193
-    public function email(string $message='', string $fieldName='')
2193
+    public function email(string $message = '', string $fieldName = '')
2194 2194
     {
2195
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2195
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2196 2196
         {
2197 2197
             return $this;
2198 2198
         }
2199 2199
         $this->string($message, $fieldName);
2200
-        if ( ! filter_var($this->value, FILTER_VALIDATE_EMAIL) )
2200
+        if ( ! filter_var($this->value, FILTER_VALIDATE_EMAIL))
2201 2201
         {
2202 2202
             $message = $message ?: $this->overrideError;
2203 2203
             $message = sprintf(
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
         {
2212 2212
             $host = substr($this->value, strpos($this->value, '@') + 1);
2213 2213
             // Likely not a FQDN, bug in PHP FILTER_VALIDATE_EMAIL prior to PHP 5.3.3
2214
-            if ( version_compare(PHP_VERSION, '5.3.3', '<') && strpos($host, '.') === false )
2214
+            if (version_compare(PHP_VERSION, '5.3.3', '<') && strpos($host, '.') === false)
2215 2215
             {
2216 2216
                 $message = $message ?: $this->overrideError;
2217 2217
                 $message = sprintf(
@@ -2233,9 +2233,9 @@  discard block
 block discarded – undo
2233 2233
      * @return Assert
2234 2234
      * @throws AssertionFailedException
2235 2235
      */
2236
-    public function emailPrefix(string $message='', string $fieldName='')
2236
+    public function emailPrefix(string $message = '', string $fieldName = '')
2237 2237
     {
2238
-        $this->value($this->value . '@example.com');
2238
+        $this->value($this->value.'@example.com');
2239 2239
 
2240 2240
         return $this->email($message, $fieldName);
2241 2241
     }
@@ -2254,14 +2254,14 @@  discard block
 block discarded – undo
2254 2254
      * @link https://github.com/symfony/Validator/blob/master/Constraints/UrlValidator.php
2255 2255
      * @link https://github.com/symfony/Validator/blob/master/Constraints/Url.php
2256 2256
      */
2257
-    public function url(string $message='', string $fieldName='')
2257
+    public function url(string $message = '', string $fieldName = '')
2258 2258
     {
2259
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2259
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2260 2260
         {
2261 2261
             return $this;
2262 2262
         }
2263 2263
         $this->string($message, $fieldName);
2264
-        $protocols = ['http', 'https'];
2264
+        $protocols = [ 'http', 'https' ];
2265 2265
         $pattern   = '~^
2266 2266
             (%s)://                                 # protocol
2267 2267
             (
@@ -2276,8 +2276,8 @@  discard block
 block discarded – undo
2276 2276
             (:[0-9]+)?                              # a port (optional)
2277 2277
             (/?|/\S+)                               # a /, nothing or a / with something
2278 2278
         $~ixu';
2279
-        $pattern   = sprintf($pattern, implode('|', $protocols));
2280
-        if ( !preg_match($pattern, $this->value) )
2279
+        $pattern = sprintf($pattern, implode('|', $protocols));
2280
+        if ( ! preg_match($pattern, $this->value))
2281 2281
         {
2282 2282
             $message = $message ?: $this->overrideError;
2283 2283
             $message = sprintf(
@@ -2302,15 +2302,15 @@  discard block
 block discarded – undo
2302 2302
      * @throws AssertionFailedException
2303 2303
      *
2304 2304
      */
2305
-    public function domainName(string $message='', string $fieldName='')
2305
+    public function domainName(string $message = '', string $fieldName = '')
2306 2306
     {
2307
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2307
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2308 2308
         {
2309 2309
             return $this;
2310 2310
         }
2311 2311
         $this->string($message, $fieldName);
2312
-        $pattern   = '/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/';
2313
-        if ( ! preg_match($pattern, $this->value) )
2312
+        $pattern = '/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/';
2313
+        if ( ! preg_match($pattern, $this->value))
2314 2314
         {
2315 2315
             $message = $message ?: $this->overrideError;
2316 2316
             $message = sprintf(
@@ -2332,9 +2332,9 @@  discard block
 block discarded – undo
2332 2332
      * @return Assert
2333 2333
      * @throws AssertionFailedException
2334 2334
      */
2335
-    public function ausMobile(string $message='', string $fieldName='')
2335
+    public function ausMobile(string $message = '', string $fieldName = '')
2336 2336
     {
2337
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2337
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2338 2338
         {
2339 2339
             return $this;
2340 2340
         }
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
         {
2343 2343
             $this->regex('/^04[0-9]{8})$/', $message, $fieldName);
2344 2344
         }
2345
-        catch ( AssertionFailedException $e )
2345
+        catch (AssertionFailedException $e)
2346 2346
         {
2347 2347
             $message = $message ?: $this->overrideError;
2348 2348
             $message = sprintf(
@@ -2365,9 +2365,9 @@  discard block
 block discarded – undo
2365 2365
      * @return Assert
2366 2366
      * @throws AssertionFailedException
2367 2367
      */
2368
-    public function alnum(string $message='', string $fieldName='')
2368
+    public function alnum(string $message = '', string $fieldName = '')
2369 2369
     {
2370
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2370
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2371 2371
         {
2372 2372
             return $this;
2373 2373
         }
@@ -2398,13 +2398,13 @@  discard block
 block discarded – undo
2398 2398
      * @return Assert
2399 2399
      * @throws AssertionFailedException
2400 2400
      */
2401
-    public function true(string $message='', string $fieldName='')
2401
+    public function true(string $message = '', string $fieldName = '')
2402 2402
     {
2403
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2403
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2404 2404
         {
2405 2405
             return $this;
2406 2406
         }
2407
-        if ( $this->value !== true )
2407
+        if ($this->value !== true)
2408 2408
         {
2409 2409
             $message = $message ?: $this->overrideError;
2410 2410
             $message = sprintf(
@@ -2426,13 +2426,13 @@  discard block
 block discarded – undo
2426 2426
      * @return Assert
2427 2427
      * @throws AssertionFailedException
2428 2428
      */
2429
-    public function truthy(string $message='', string $fieldName='')
2429
+    public function truthy(string $message = '', string $fieldName = '')
2430 2430
     {
2431
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2431
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2432 2432
         {
2433 2433
             return $this;
2434 2434
         }
2435
-        if ( ! $this->value )
2435
+        if ( ! $this->value)
2436 2436
         {
2437 2437
             $message = $message ?: $this->overrideError;
2438 2438
             $message = sprintf(
@@ -2454,13 +2454,13 @@  discard block
 block discarded – undo
2454 2454
      * @return Assert
2455 2455
      * @throws AssertionFailedException
2456 2456
      */
2457
-    public function false(string $message='', string $fieldName='')
2457
+    public function false(string $message = '', string $fieldName = '')
2458 2458
     {
2459
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2459
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2460 2460
         {
2461 2461
             return $this;
2462 2462
         }
2463
-        if ( $this->value !== false )
2463
+        if ($this->value !== false)
2464 2464
         {
2465 2465
             $message = $message ?: $this->overrideError;
2466 2466
             $message = sprintf(
@@ -2482,13 +2482,13 @@  discard block
 block discarded – undo
2482 2482
      * @return Assert
2483 2483
      * @throws AssertionFailedException
2484 2484
      */
2485
-    public function notFalse(string $message='', string $fieldName='')
2485
+    public function notFalse(string $message = '', string $fieldName = '')
2486 2486
     {
2487
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2487
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2488 2488
         {
2489 2489
             return $this;
2490 2490
         }
2491
-        if ( $this->value === false )
2491
+        if ($this->value === false)
2492 2492
         {
2493 2493
             $message = $message ?: $this->overrideError;
2494 2494
             $message = sprintf(
@@ -2510,13 +2510,13 @@  discard block
 block discarded – undo
2510 2510
      * @return Assert
2511 2511
      * @throws AssertionFailedException
2512 2512
      */
2513
-    public function classExists(string $message='', string $fieldName='')
2513
+    public function classExists(string $message = '', string $fieldName = '')
2514 2514
     {
2515
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2515
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2516 2516
         {
2517 2517
             return $this;
2518 2518
         }
2519
-        if ( !class_exists($this->value) )
2519
+        if ( ! class_exists($this->value))
2520 2520
         {
2521 2521
             $message = $message ?: $this->overrideError;
2522 2522
             $message = sprintf(
@@ -2538,14 +2538,14 @@  discard block
 block discarded – undo
2538 2538
      * @throws AssertionFailedException
2539 2539
      * @throws \ReflectionException
2540 2540
      */
2541
-    public function implementsInterface($interfaceName, string $message='', string $fieldName='')
2541
+    public function implementsInterface($interfaceName, string $message = '', string $fieldName = '')
2542 2542
     {
2543
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2543
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2544 2544
         {
2545 2545
             return $this;
2546 2546
         }
2547 2547
         $reflection = new \ReflectionClass($this->value);
2548
-        if ( !$reflection->implementsInterface($interfaceName) )
2548
+        if ( ! $reflection->implementsInterface($interfaceName))
2549 2549
         {
2550 2550
             $message = $message ?: $this->overrideError;
2551 2551
             $message = sprintf(
@@ -2554,7 +2554,7 @@  discard block
 block discarded – undo
2554 2554
                 $this->stringify($interfaceName)
2555 2555
             );
2556 2556
 
2557
-            throw $this->createException($message, self::INTERFACE_NOT_IMPLEMENTED, $fieldName, ['interface' => $interfaceName]);
2557
+            throw $this->createException($message, self::INTERFACE_NOT_IMPLEMENTED, $fieldName, [ 'interface' => $interfaceName ]);
2558 2558
         }
2559 2559
 
2560 2560
         return $this;
@@ -2574,13 +2574,13 @@  discard block
 block discarded – undo
2574 2574
      * @return Assert
2575 2575
      * @throws AssertionFailedException
2576 2576
      */
2577
-    public function isJsonString(string $message='', string $fieldName='')
2577
+    public function isJsonString(string $message = '', string $fieldName = '')
2578 2578
     {
2579
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2579
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2580 2580
         {
2581 2581
             return $this;
2582 2582
         }
2583
-        if ( null === json_decode($this->value) && JSON_ERROR_NONE !== json_last_error() )
2583
+        if (null === json_decode($this->value) && JSON_ERROR_NONE !== json_last_error())
2584 2584
         {
2585 2585
             $message = $message ?: $this->overrideError;
2586 2586
             $message = sprintf(
@@ -2604,18 +2604,18 @@  discard block
 block discarded – undo
2604 2604
      * @return Assert
2605 2605
      * @throws AssertionFailedException
2606 2606
      */
2607
-    public function uuid(string $message='', string $fieldName='')
2607
+    public function uuid(string $message = '', string $fieldName = '')
2608 2608
     {
2609
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2609
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2610 2610
         {
2611 2611
             return $this;
2612 2612
         }
2613
-        $this->value = str_replace(['urn:', 'uuid:', '{', '}'], '', $this->value);
2614
-        if ( $this->value === '00000000-0000-0000-0000-000000000000' )
2613
+        $this->value = str_replace([ 'urn:', 'uuid:', '{', '}' ], '', $this->value);
2614
+        if ($this->value === '00000000-0000-0000-0000-000000000000')
2615 2615
         {
2616 2616
             return $this;
2617 2617
         }
2618
-        if ( !preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $this->value) )
2618
+        if ( ! preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $this->value))
2619 2619
         {
2620 2620
             $message = $message ?: $this->overrideError;
2621 2621
             $message = sprintf(
@@ -2644,13 +2644,13 @@  discard block
 block discarded – undo
2644 2644
      * @return Assert
2645 2645
      * @throws AssertionFailedException
2646 2646
      */
2647
-    public function samAccountName(string $message='', string $fieldName='')
2647
+    public function samAccountName(string $message = '', string $fieldName = '')
2648 2648
     {
2649
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2649
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2650 2650
         {
2651 2651
             return $this;
2652 2652
         }
2653
-        if ( !preg_match('/^([a-z0-9]{4,20})$/', $this->value) )
2653
+        if ( ! preg_match('/^([a-z0-9]{4,20})$/', $this->value))
2654 2654
         {
2655 2655
             $message = $message ?: $this->overrideError;
2656 2656
             $message = sprintf(
@@ -2672,9 +2672,9 @@  discard block
 block discarded – undo
2672 2672
      * @return Assert
2673 2673
      * @throws AssertionFailedException
2674 2674
      */
2675
-    public function userPrincipalName(string $message='', string $fieldName='')
2675
+    public function userPrincipalName(string $message = '', string $fieldName = '')
2676 2676
     {
2677
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2677
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2678 2678
         {
2679 2679
             return $this;
2680 2680
         }
@@ -2706,13 +2706,13 @@  discard block
 block discarded – undo
2706 2706
      * @return Assert
2707 2707
      * @throws AssertionFailedException
2708 2708
      */
2709
-    public function count($count, string $message='', string $fieldName='')
2709
+    public function count($count, string $message = '', string $fieldName = '')
2710 2710
     {
2711
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2711
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2712 2712
         {
2713 2713
             return $this;
2714 2714
         }
2715
-        if ( $count !== count($this->value) )
2715
+        if ($count !== count($this->value))
2716 2716
         {
2717 2717
             $message = $message ?: $this->overrideError;
2718 2718
             $message = sprintf(
@@ -2721,7 +2721,7 @@  discard block
 block discarded – undo
2721 2721
                 $this->stringify($count)
2722 2722
             );
2723 2723
 
2724
-            throw $this->createException($message, $this->overrideCode ?: self::INVALID_COUNT, $fieldName, ['count' => $count]);
2724
+            throw $this->createException($message, $this->overrideCode ?: self::INVALID_COUNT, $fieldName, [ 'count' => $count ]);
2725 2725
         }
2726 2726
 
2727 2727
         return $this;
@@ -2735,25 +2735,25 @@  discard block
 block discarded – undo
2735 2735
      */
2736 2736
     protected function doAllOrNullOr($func, $args)
2737 2737
     {
2738
-        if ( $this->nullOr && is_null($this->value) )
2738
+        if ($this->nullOr && is_null($this->value))
2739 2739
         {
2740 2740
             return true;
2741 2741
         }
2742
-        if ( $this->emptyOr && empty($this->value) )
2742
+        if ($this->emptyOr && empty($this->value))
2743 2743
         {
2744 2744
             return true;
2745 2745
         }
2746
-        if ( $this->all && (new Assert($this->value))->setExceptionClass($this->exceptionClass)->isTraversable() )
2746
+        if ($this->all && (new Assert($this->value))->setExceptionClass($this->exceptionClass)->isTraversable())
2747 2747
         {
2748
-            foreach ( $this->value as $idx => $value )
2748
+            foreach ($this->value as $idx => $value)
2749 2749
             {
2750 2750
                 $object = (new Assert($value))->setExceptionClass($this->exceptionClass);
2751
-                call_user_func_array([$object, $func], $args);
2751
+                call_user_func_array([ $object, $func ], $args);
2752 2752
             }
2753 2753
             return true;
2754 2754
         }
2755 2755
 
2756
-        return ( $this->nullOr && is_null($this->value) ) || ( $this->emptyOr && empty($this->value) ) ? true : false;
2756
+        return ($this->nullOr && is_null($this->value)) || ($this->emptyOr && empty($this->value)) ? true : false;
2757 2757
     }
2758 2758
 
2759 2759
     /**
@@ -2765,14 +2765,14 @@  discard block
 block discarded – undo
2765 2765
      * @return $this
2766 2766
      * @throws AssertionFailedException
2767 2767
      */
2768
-    public function choicesNotEmpty(array $choices, string $message='', string $fieldName='')
2768
+    public function choicesNotEmpty(array $choices, string $message = '', string $fieldName = '')
2769 2769
     {
2770
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2770
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2771 2771
         {
2772 2772
             return $this;
2773 2773
         }
2774 2774
         $this->notEmpty($message, $fieldName);
2775
-        foreach ( $choices as $choice )
2775
+        foreach ($choices as $choice)
2776 2776
         {
2777 2777
             $this->notEmptyKey($choice, $message, $fieldName);
2778 2778
         }
@@ -2789,14 +2789,14 @@  discard block
 block discarded – undo
2789 2789
      * @returns Assert
2790 2790
      * @throws AssertionFailedException
2791 2791
      */
2792
-    public function methodExists($object, string $message='', string $fieldName='')
2792
+    public function methodExists($object, string $message = '', string $fieldName = '')
2793 2793
     {
2794
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2794
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2795 2795
         {
2796 2796
             return $this;
2797 2797
         }
2798 2798
         (new Assert($object))->setExceptionClass($this->exceptionClass)->isObject($message, $fieldName);
2799
-        if ( !method_exists($object, $this->value) )
2799
+        if ( ! method_exists($object, $this->value))
2800 2800
         {
2801 2801
             $message = $message ?: $this->overrideError;
2802 2802
             $message = sprintf(
@@ -2818,13 +2818,13 @@  discard block
 block discarded – undo
2818 2818
      * @return $this
2819 2819
      * @throws AssertionFailedException
2820 2820
      */
2821
-    public function isObject(string $message='', string $fieldName='')
2821
+    public function isObject(string $message = '', string $fieldName = '')
2822 2822
     {
2823
-        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
2823
+        if ($this->doAllOrNullOr(__FUNCTION__, func_get_args()))
2824 2824
         {
2825 2825
             return $this;
2826 2826
         }
2827
-        if ( !is_object($this->value) )
2827
+        if ( ! is_object($this->value))
2828 2828
         {
2829 2829
             $message = $message ?: $this->overrideError;
2830 2830
             $message = sprintf(
@@ -2846,32 +2846,32 @@  discard block
 block discarded – undo
2846 2846
      */
2847 2847
     private function stringify($value)
2848 2848
     {
2849
-        if ( is_bool($value) )
2849
+        if (is_bool($value))
2850 2850
         {
2851 2851
             return $value ? '<TRUE>' : '<FALSE>';
2852 2852
         }
2853
-        if ( is_scalar($value) )
2853
+        if (is_scalar($value))
2854 2854
         {
2855 2855
             $val = (string)$value;
2856
-            if ( strlen($val) > 100 )
2856
+            if (strlen($val) > 100)
2857 2857
             {
2858
-                $val = substr($val, 0, 97) . '...';
2858
+                $val = substr($val, 0, 97).'...';
2859 2859
             }
2860 2860
             return $val;
2861 2861
         }
2862
-        if ( is_array($value) )
2862
+        if (is_array($value))
2863 2863
         {
2864 2864
             return '<ARRAY>';
2865 2865
         }
2866
-        if ( is_object($value) )
2866
+        if (is_object($value))
2867 2867
         {
2868 2868
             return get_class($value);
2869 2869
         }
2870
-        if ( is_resource($value) )
2870
+        if (is_resource($value))
2871 2871
         {
2872 2872
             return '<RESOURCE>';
2873 2873
         }
2874
-        if ( $value === null )
2874
+        if ($value === null)
2875 2875
         {
2876 2876
             return '<NULL>';
2877 2877
         }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -158,8 +158,7 @@  discard block
 block discarded – undo
158 158
             {
159 159
 
160 160
                 $validator->__invoke();
161
-            }
162
-            catch ( AssertionFailedException $e )
161
+            } catch ( AssertionFailedException $e )
163 162
             {
164 163
                 $errors[$fieldName]     = $e->getMessage();
165 164
             }
@@ -2206,8 +2205,7 @@  discard block
 block discarded – undo
2206 2205
             );
2207 2206
 
2208 2207
             throw $this->createException($message, $this->overrideCode ?: self::INVALID_EMAIL, $fieldName);
2209
-        }
2210
-        else
2208
+        } else
2211 2209
         {
2212 2210
             $host = substr($this->value, strpos($this->value, '@') + 1);
2213 2211
             // Likely not a FQDN, bug in PHP FILTER_VALIDATE_EMAIL prior to PHP 5.3.3
@@ -2341,8 +2339,7 @@  discard block
 block discarded – undo
2341 2339
         try
2342 2340
         {
2343 2341
             $this->regex('/^04[0-9]{8})$/', $message, $fieldName);
2344
-        }
2345
-        catch ( AssertionFailedException $e )
2342
+        } catch ( AssertionFailedException $e )
2346 2343
         {
2347 2344
             $message = $message ?: $this->overrideError;
2348 2345
             $message = sprintf(
@@ -2374,8 +2371,7 @@  discard block
 block discarded – undo
2374 2371
         try
2375 2372
         {
2376 2373
             $this->regex('(^([a-zA-Z]{1}[a-zA-Z0-9]*)$)', $message, $fieldName);
2377
-        }
2378
-        catch (AssertionFailedException $e)
2374
+        } catch (AssertionFailedException $e)
2379 2375
         {
2380 2376
             $message = $message ?: $this->overrideError;
2381 2377
             $message = sprintf(
@@ -2681,8 +2677,7 @@  discard block
 block discarded – undo
2681 2677
         try
2682 2678
         {
2683 2679
             $this->email($message, $fieldName);
2684
-        }
2685
-        catch (AssertionFailedException $e)
2680
+        } catch (AssertionFailedException $e)
2686 2681
         {
2687 2682
             $message = $message ?: $this->overrideError;
2688 2683
             $message = sprintf(
Please login to merge, or discard this patch.
src/AssertionFailedException.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Terah\Assert;
4 4
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param array $constraints
41 41
      * @param string $level
42 42
      */
43
-    public function __construct(string $message, int $code, string string $fieldName='', $value, array $constraints=[], string $level='critical', string $propertyPath = null)
43
+    public function __construct(string $message, int $code, string string $fieldName = '', $value, array $constraints = [ ], string $level = 'critical', string $propertyPath = null)
44 44
     {
45 45
         parent::__construct($message, $code);
46 46
         $this->fieldName        = $fieldName;
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
         $this->constraints      = $constraints;
49 49
         $this->level            = $level;
50 50
         $this->propertyPath     = $propertyPath;
51
-        foreach ( $this->getTrace() as $point )
51
+        foreach ($this->getTrace() as $point)
52 52
         {
53
-            if ( $this->location )
53
+            if ($this->location)
54 54
             {
55 55
                 continue;
56 56
             }
57
-            $class = $point['class'] ??0?: '';
58
-            if ( $class !== 'Terah\\Assert\\Assert' )
57
+            $class = $point[ 'class' ] ??0 ?: '';
58
+            if ($class !== 'Terah\\Assert\\Assert')
59 59
             {
60 60
                 $this->location = (object)$point;
61 61
             }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function getPropertyPathAndCallingLocation() : string
125 125
     {
126
-        return $this->getPropertyPath() . ' in ' . $this->getCallingFileAndLine();
126
+        return $this->getPropertyPath().' in '.$this->getCallingFileAndLine();
127 127
     }
128 128
 
129 129
     /**
@@ -134,15 +134,15 @@  discard block
 block discarded – undo
134 134
      */
135 135
     protected function getCallingFileAndLine() : string
136 136
     {
137
-        foreach ( $this->getTrace() as $trace )
137
+        foreach ($this->getTrace() as $trace)
138 138
         {
139 139
             $trace = (object)$trace;
140
-            if ( empty($trace->file) )
140
+            if (empty($trace->file))
141 141
             {
142 142
                 continue;
143 143
             }
144 144
             $file = static::beforeLast('.php', static::afterLast('/', $trace->file));
145
-            if ( in_array($file, ['AssertionChain', 'Assertion']) )
145
+            if (in_array($file, [ 'AssertionChain', 'Assertion' ]))
146 146
             {
147 147
                 continue;
148 148
             }
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
      * @param bool $return_original
170 170
      * @return string
171 171
      */
172
-    public static function afterLast(string $needle, string $haystack, bool $return_original=false) : string
172
+    public static function afterLast(string $needle, string $haystack, bool $return_original = false) : string
173 173
     {
174
-        if ( static::strrevpos($haystack, $needle) !== -1 )
174
+        if (static::strrevpos($haystack, $needle) !== -1)
175 175
         {
176 176
             return mb_substr($haystack, static::strrevpos($haystack, $needle) + mb_strlen($needle));
177 177
         }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      */
199 199
     public static function beforeLast(string $needle, string $haystack) : string
200 200
     {
201
-        $position   = static::strrevpos($haystack, $needle);
201
+        $position = static::strrevpos($haystack, $needle);
202 202
 
203 203
         return $position === -1 ? '' : mb_substr($haystack, 0, static::strrevpos($haystack, $needle));
204 204
     }
Please login to merge, or discard this patch.