@@ -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 |
@@ -171,17 +171,17 @@ |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | if (isset($this->parameters[$l])) { |
| 174 | - $string .= $this->parameters[$i] . ' '; |
|
| 174 | + $string .= $this->parameters[$i].' '; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if ($o) { |
| 178 | - $string .= str_repeat(']', $o) . ' '; |
|
| 178 | + $string .= str_repeat(']', $o).' '; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | $string .= ')'; |
| 182 | 182 | |
| 183 | 183 | if ($this->returnType->typeName !== null) { |
| 184 | - $string .= ' : ' . $this->returnType; |
|
| 184 | + $string .= ' : '.$this->returnType; |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | return $string; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $string .= '?'; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - $string .= $this->typeName . ' '; |
|
| 114 | + $string .= $this->typeName.' '; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | if ($this->isByReference) { |
@@ -122,6 +122,6 @@ discard block |
||
| 122 | 122 | $string .= '...'; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - return $string . '$' . $this->parameterName; |
|
| 125 | + return $string.'$'.$this->parameterName; |
|
| 126 | 126 | } |
| 127 | 127 | } |
@@ -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); |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | public function __toString() |
| 58 | 58 | { |
| 59 | 59 | return $this->isNullable && $this->typeName !== null |
| 60 | - ? '?' . $this->typeName |
|
| 60 | + ? '?'.$this->typeName |
|
| 61 | 61 | : (string)$this->typeName; |
| 62 | 62 | } |
| 63 | 63 | } |