@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | |
30 | 30 | self::_init( ); |
31 | 31 | |
32 | - if( !self::_validate_constants( $scalar ) or !isset( self::$___constants[ static::class ][ 1 ][ $scalar ] ) ) |
|
33 | - throw new InvalidInitializer; |
|
32 | + if( !self::_validate_constants( $scalar ) or !isset( self::$___constants[ static::class ][ 1 ][ $scalar ] ) ) { |
|
33 | + throw new InvalidInitializer; |
|
34 | + } |
|
34 | 35 | |
35 | 36 | $this->scalar = $scalar; |
36 | 37 | |
@@ -38,12 +39,15 @@ discard block |
||
38 | 39 | |
39 | 40 | final public static function __callStatic( string $name, array $args ) { |
40 | 41 | |
41 | - if( !empty( $args ) ) throw new InvalidArgumentException( ); |
|
42 | + if( !empty( $args ) ) { |
|
43 | + throw new InvalidArgumentException( ); |
|
44 | + } |
|
42 | 45 | |
43 | 46 | self::_init( ); |
44 | 47 | |
45 | - if( !isset( self::$___constants[ static::class ][ 0 ][ $name ] ) ) |
|
46 | - throw new InvalidInitializer( ); |
|
48 | + if( !isset( self::$___constants[ static::class ][ 0 ][ $name ] ) ) { |
|
49 | + throw new InvalidInitializer( ); |
|
50 | + } |
|
47 | 51 | |
48 | 52 | $class = static::class; |
49 | 53 | return new $class( self::$___constants[ static::class ][ 0 ][ $name ] ); |
@@ -59,8 +63,9 @@ discard block |
||
59 | 63 | |
60 | 64 | foreach( $csts as $key => $value ) { |
61 | 65 | |
62 | - if( !static::_validate_constants( $value ) ) |
|
63 | - throw new EnumConstantTypeException( static::class, $key, gettype( $value ) ); |
|
66 | + if( !static::_validate_constants( $value ) ) { |
|
67 | + throw new EnumConstantTypeException( static::class, $key, gettype( $value ) ); |
|
68 | + } |
|
64 | 69 | |
65 | 70 | $vals[$value] = true; |
66 | 71 | |
@@ -76,8 +81,12 @@ discard block |
||
76 | 81 | |
77 | 82 | protected static function _validate_constants( $value ) : bool { |
78 | 83 | |
79 | - if( is_int( $value ) ) return true; |
|
80 | - if( is_string( $value ) && $value !== '' ) return true; |
|
84 | + if( is_int( $value ) ) { |
|
85 | + return true; |
|
86 | + } |
|
87 | + if( is_string( $value ) && $value !== '' ) { |
|
88 | + return true; |
|
89 | + } |
|
81 | 90 | return false; |
82 | 91 | |
83 | 92 | } |