@@ -28,6 +28,6 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | public function __toString(): string |
| 30 | 30 | { |
| 31 | - return '[' . $this->of . ']'; |
|
| 31 | + return '['.$this->of.']'; |
|
| 32 | 32 | } |
| 33 | 33 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct(TypeInterface $of) |
| 22 | 22 | { |
| 23 | - parent::__construct(static::LIST, $of); |
|
| 23 | + parent::__construct(static::list, $of); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | { |
| 66 | 66 | \assert(Name::isValid($name), 'Interface is not generic type'); |
| 67 | 67 | |
| 68 | - $interface = static::new(static::INTERFACE); |
|
| 68 | + $interface = static::new(static::interface); |
|
| 69 | 69 | |
| 70 | 70 | return $name ? static::new($name, $interface) : $interface; |
| 71 | 71 | } |
@@ -69,6 +69,6 @@ |
||
| 69 | 69 | */ |
| 70 | 70 | public static function null(): TypeInterface |
| 71 | 71 | { |
| 72 | - return static::new(static::NULL); |
|
| 72 | + return static::new(static::null); |
|
| 73 | 73 | } |
| 74 | 74 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | protected static function getInternalType(string $name, ?TypeInterface $of, \Closure $otherwise): TypeInterface |
| 51 | 51 | { |
| 52 | 52 | if (isset(static::$internal[$name])) { |
| 53 | - $subtypeOfInternal = ! $of || $of->typeOf(static::$internal[$name]); |
|
| 53 | + $subtypeOfInternal = !$of || $of->typeOf(static::$internal[$name]); |
|
| 54 | 54 | |
| 55 | 55 | return $subtypeOfInternal ? static::$internal[$name] : $otherwise(); |
| 56 | 56 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @var string |
| 34 | 34 | */ |
| 35 | - public const INTERFACE = 'Interface'; |
|
| 35 | + public const interface = 'Interface'; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @var string |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | /** |
| 88 | 88 | * @var string |
| 89 | 89 | */ |
| 90 | - public const LIST = 'List'; |
|
| 90 | + public const list = 'List'; |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * @var string |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | /** |
| 133 | 133 | * @var string |
| 134 | 134 | */ |
| 135 | - public const NULL = 'Null'; |
|
| 135 | + public const null = 'Null'; |
|
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | 138 | * @var string[] |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | self::SCALAR, |
| 142 | 142 | self::OBJECT, |
| 143 | 143 | self::DIRECTIVE, |
| 144 | - self::INTERFACE, |
|
| 144 | + self::interface, |
|
| 145 | 145 | self::UNION, |
| 146 | 146 | self::ENUM, |
| 147 | 147 | self::INPUT_OBJECT, |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public const WRAPPING_TYPES = [ |
| 167 | 167 | self::NON_NULL, |
| 168 | - self::LIST, |
|
| 168 | + self::list, |
|
| 169 | 169 | ]; |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | self::INPUT_OBJECT, |
| 179 | 179 | self::INPUT_FIELD, |
| 180 | 180 | self::NON_NULL, |
| 181 | - self::LIST, |
|
| 181 | + self::list, |
|
| 182 | 182 | self::ANY |
| 183 | 183 | ]; |
| 184 | 184 | |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | public const ALLOWS_TO_OUTPUT = [ |
| 189 | 189 | self::SCALAR, |
| 190 | 190 | self::OBJECT, |
| 191 | - self::INTERFACE, |
|
| 191 | + self::interface, |
|
| 192 | 192 | self::UNION, |
| 193 | 193 | self::ENUM, |
| 194 | 194 | self::NON_NULL, |
| 195 | - self::LIST, |
|
| 195 | + self::list, |
|
| 196 | 196 | self::ANY, |
| 197 | 197 | ]; |
| 198 | 198 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | self::FLOAT, |
| 207 | 207 | self::ID, |
| 208 | 208 | self::DATE_TIME, |
| 209 | - self::NULL, |
|
| 209 | + self::null, |
|
| 210 | 210 | ]; |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | parent::__construct(static::NON_NULL, $parent); |
| 24 | 24 | |
| 25 | - \assert(! $this->is($parent), __CLASS__ . ' can not be wrapped by itself'); |
|
| 25 | + \assert(!$this->is($parent), __CLASS__.' can not be wrapped by itself'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -30,6 +30,6 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function __toString(): string |
| 32 | 32 | { |
| 33 | - return $this->of . '!'; |
|
| 33 | + return $this->of.'!'; |
|
| 34 | 34 | } |
| 35 | 35 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | { |
| 22 | 22 | return [ |
| 23 | 23 | static::ROOT_TYPE => $any = self::createInternalType(static::ROOT_TYPE), |
| 24 | - static::INTERFACE => $interface = self::createInternalType(static::INTERFACE), |
|
| 24 | + static::interface => $interface = self::createInternalType(static::interface), |
|
| 25 | 25 | static::OBJECT => $object = self::createInternalType(static::OBJECT, $interface), |
| 26 | 26 | static::INPUT_OBJECT => $input = self::createInternalType(static::INPUT_OBJECT, $object), |
| 27 | 27 | static::UNION => $union = self::createInternalType(static::UNION, $object), |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | self::FLOAT => $float = self::createInternalType(self::FLOAT, $string), |
| 38 | 38 | self::INT => $int = self::createInternalType(self::INT, $float), |
| 39 | 39 | self::BOOLEAN => $bool = self::createInternalType(self::BOOLEAN, $string), |
| 40 | - self::NULL => $null = self::createInternalType(self::NULL, Type::scalar()), |
|
| 40 | + self::null => $null = self::createInternalType(self::null, Type::scalar()), |
|
| 41 | 41 | self::ID => $id = self::createInternalType(self::ID, $string), |
| 42 | 42 | self::DATE_TIME => $date = self::createInternalType(self::DATE_TIME, $string), |
| 43 | 43 | ]; |
@@ -57,19 +57,19 @@ |
||
| 57 | 57 | { |
| 58 | 58 | switch (true) { |
| 59 | 59 | case $name === null || !$name: |
| 60 | - return static::empty((bool)$global); |
|
| 60 | + return static::empty((bool) $global); |
|
| 61 | 61 | |
| 62 | 62 | case $name instanceof TypeNameInterface: |
| 63 | 63 | return $name; |
| 64 | 64 | |
| 65 | 65 | case \is_array($name): |
| 66 | - return static::fromArray($name, (bool)$global); |
|
| 66 | + return static::fromArray($name, (bool) $global); |
|
| 67 | 67 | |
| 68 | 68 | case \is_iterable($name): |
| 69 | - return static::fromArray(\iterator_to_array($name, false), (bool)$global); |
|
| 69 | + return static::fromArray(\iterator_to_array($name, false), (bool) $global); |
|
| 70 | 70 | |
| 71 | 71 | case \is_scalar($name): |
| 72 | - return static::fromString((string)$name, $global); |
|
| 72 | + return static::fromString((string) $name, $global); |
|
| 73 | 73 | |
| 74 | 74 | default: |
| 75 | 75 | $error = 'Unsupported argument type of %s(self|array|iterable|scalar $name = %s)'; |