Passed
Push — master ( 0e8760...e8c123 )
by 4kizuki
01:58
created
src/Enum.php 1 patch
Braces   +18 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,8 +30,9 @@  discard block
 block discarded – undo
30 30
 
31 31
         self::_init( );
32 32
 
33
-        if( !static::_validate_constants( $scalar ) or !isset( self::$constants[ static::class ][ 1 ][ $scalar ] ) )
34
-            throw new InvalidInitializerException;
33
+        if( !static::_validate_constants( $scalar ) or !isset( self::$constants[ static::class ][ 1 ][ $scalar ] ) ) {
34
+                    throw new InvalidInitializerException;
35
+        }
35 36
 
36 37
         $this->scalar = $scalar;
37 38
 
@@ -39,12 +40,15 @@  discard block
 block discarded – undo
39 40
 
40 41
     final public static function __callStatic( string $name, array $args ) {
41 42
 
42
-        if( !empty( $args ) ) throw new BadMethodCallException;
43
+        if( !empty( $args ) ) {
44
+            throw new BadMethodCallException;
45
+        }
43 46
 
44 47
         self::_init( );
45 48
 
46
-        if( !isset( self::$constants[ static::class ][ 0 ][ $name ] ) )
47
-            throw new InvalidInitializerException;
49
+        if( !isset( self::$constants[ static::class ][ 0 ][ $name ] ) ) {
50
+                    throw new InvalidInitializerException;
51
+        }
48 52
 
49 53
         $class = static::class;
50 54
         return new $class( self::$constants[ static::class ][ 0 ][ $name ] );
@@ -59,7 +63,9 @@  discard block
 block discarded – undo
59 63
 
60 64
     private static function _init( ) {
61 65
 
62
-        if( isset( self::$constants[ static::class ] ) ) return;
66
+        if( isset( self::$constants[ static::class ] ) ) {
67
+            return;
68
+        }
63 69
 
64 70
         $csts = ( new ReflectionClass( static::class ) )->getConstants();
65 71
         $vals = [ ];
@@ -80,8 +86,12 @@  discard block
 block discarded – undo
80 86
 
81 87
     protected static function _validate_constants( $value ) : bool {
82 88
 
83
-        if( is_int( $value ) ) return true;
84
-        if( is_string( $value ) && $value !== '' ) return true;
89
+        if( is_int( $value ) ) {
90
+            return true;
91
+        }
92
+        if( is_string( $value ) && $value !== '' ) {
93
+            return true;
94
+        }
85 95
         return false;
86 96
 
87 97
     }
Please login to merge, or discard this patch.