@@ -12,7 +12,7 @@ |
||
12 | 12 | /** |
13 | 13 | * Nullable types are either explicitly ?type (PHP>=7.1) or with a default value of null |
14 | 14 | */ |
15 | - const NULLABLE = 0x02; |
|
15 | + const NULLABLE = 0x02; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Reference types must always match |
@@ -2,4 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace DaveRandom\CallbackValidator; |
4 | 4 | |
5 | -class InvalidCallbackException extends \LogicException {} |
|
5 | +class InvalidCallbackException extends \LogicException |
|
6 | +{ |
|
7 | +} |
@@ -7,7 +7,9 @@ |
||
7 | 7 | /** |
8 | 8 | * Thou shalt not instantiate |
9 | 9 | */ |
10 | - private function __construct() { } |
|
10 | + private function __construct() |
|
11 | + { |
|
12 | +} |
|
11 | 13 | |
12 | 14 | const STRING = 'string'; |
13 | 15 | const INT = 'int'; |
@@ -13,8 +13,8 @@ |
||
13 | 13 | const INT = 'int'; |
14 | 14 | const FLOAT = 'float'; |
15 | 15 | const BOOL = 'bool'; |
16 | - const ARRAY = 'array'; |
|
16 | + const array = 'array'; |
|
17 | 17 | const VOID = 'void'; |
18 | - const CALLABLE = 'callable'; |
|
18 | + const callable = 'callable'; |
|
19 | 19 | const ITERABLE = 'iterable'; |
20 | 20 | } |
@@ -7,7 +7,9 @@ |
||
7 | 7 | /** |
8 | 8 | * Thou shalt not instantiate |
9 | 9 | */ |
10 | - private function __construct() { } |
|
10 | + private function __construct() |
|
11 | + { |
|
12 | +} |
|
11 | 13 | |
12 | 14 | /** |
13 | 15 | * Lookup table of all built-in types |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | BuiltInTypes::INT => true, |
18 | 18 | BuiltInTypes::FLOAT => true, |
19 | 19 | BuiltInTypes::BOOL => true, |
20 | - BuiltInTypes::ARRAY => true, |
|
21 | - BuiltInTypes::CALLABLE => true, |
|
20 | + BuiltInTypes::array => true, |
|
21 | + BuiltInTypes::callable => true, |
|
22 | 22 | BuiltInTypes::VOID => true, |
23 | 23 | BuiltInTypes::ITERABLE => true, |
24 | 24 | ]; |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | |
70 | 70 | // Check iterable |
71 | 71 | if ($superTypeName === BuiltInTypes::ITERABLE) { |
72 | - return $subTypeName === BuiltInTypes::ARRAY |
|
72 | + return $subTypeName === BuiltInTypes::array |
|
73 | 73 | || $subTypeName === \Traversable::class |
74 | 74 | || \is_subclass_of($subTypeName, \Traversable::class); |
75 | 75 | } |
76 | 76 | |
77 | 77 | // Check callable |
78 | - if ($superTypeName === BuiltInTypes::CALLABLE) { |
|
78 | + if ($superTypeName === BuiltInTypes::callable) { |
|
79 | 79 | return $subTypeName === \Closure::class |
80 | 80 | || \method_exists($subTypeName, '__invoke') |
81 | 81 | || \is_subclass_of($subTypeName, \Closure::class); |