@@ -77,7 +77,7 @@ |
||
| 77 | 77 | $this->name = $name; |
| 78 | 78 | |
| 79 | 79 | $this->description = $data; |
| 80 | - $this->required = (bool)$required; |
|
| 80 | + $this->required = (bool) $required; |
|
| 81 | 81 | |
| 82 | 82 | // Parse regex |
| 83 | 83 | $match = []; |
@@ -120,18 +120,18 @@ discard block |
||
| 120 | 120 | return $this; |
| 121 | 121 | |
| 122 | 122 | case 'min': |
| 123 | - $this->minProperties = (int)$data; |
|
| 123 | + $this->minProperties = (int) $data; |
|
| 124 | 124 | if ($this->minProperties < 0) { |
| 125 | 125 | throw new Exception("Minimum less than zero: '{$data}'"); |
| 126 | 126 | } |
| 127 | 127 | if ($this->maxProperties !== null && $this->minProperties > $this->maxProperties) { |
| 128 | 128 | throw new Exception("Minimum greater than maximum: '{$data}'"); |
| 129 | 129 | } |
| 130 | - $this->minProperties = (int)$data; |
|
| 130 | + $this->minProperties = (int) $data; |
|
| 131 | 131 | return $this; |
| 132 | 132 | |
| 133 | 133 | case 'max': |
| 134 | - $this->maxProperties = (int)$data; |
|
| 134 | + $this->maxProperties = (int) $data; |
|
| 135 | 135 | if ($this->minProperties !== null && $this->minProperties > $this->maxProperties) { |
| 136 | 136 | throw new Exception("Maximum less than minimum: '{$data}'"); |
| 137 | 137 | } |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | $exclusiveMinimum = $match[3] == '<'; |
| 288 | - $this->minProperties = $match[4] === '' ? null : (int)$match[4]; |
|
| 289 | - $this->maxProperties = $match[5] === '' ? null : (int)$match[5]; |
|
| 288 | + $this->minProperties = $match[4] === '' ? null : (int) $match[4]; |
|
| 289 | + $this->maxProperties = $match[5] === '' ? null : (int) $match[5]; |
|
| 290 | 290 | $exclusiveMaximum = isset($match[6]) ? ($match[6] == '>') : null; |
| 291 | 291 | if ($this->minProperties && $this->maxProperties && $this->minProperties > $this->maxProperties) { |
| 292 | 292 | self::swap($this->minProperties, $this->maxProperties); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | return $this; |
| 62 | 62 | |
| 63 | 63 | case 'step': |
| 64 | - if (($step = (int)$data) > 0) { |
|
| 64 | + if (($step = (int) $data) > 0) { |
|
| 65 | 65 | $this->multipleOf = $step; |
| 66 | 66 | } |
| 67 | 67 | return $this; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - return (int)$value; |
|
| 93 | + return (int) $value; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | public function toArray(): array |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $this->exclusiveMinimum = $match[2] == '<'; |
| 160 | - $this->minimum = $match[3] === '' ? null : (int)$match[3]; |
|
| 161 | - $this->maximum = $match[4] === '' ? null : (int)$match[4]; |
|
| 160 | + $this->minimum = $match[3] === '' ? null : (int) $match[3]; |
|
| 161 | + $this->maximum = $match[4] === '' ? null : (int) $match[4]; |
|
| 162 | 162 | $this->exclusiveMaximum = isset($match[5]) ? ($match[5] == '>') : null; |
| 163 | 163 | if ($this->minimum && $this->maximum && $this->minimum > $this->maximum) { |
| 164 | 164 | self::swap($this->minimum, $this->maximum); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | return $this; |
| 59 | 59 | |
| 60 | 60 | case 'step': |
| 61 | - if (($step = (float)$data) > 0) { |
|
| 61 | + if (($step = (float) $data) > 0) { |
|
| 62 | 62 | $this->multipleOf = $step; |
| 63 | 63 | } |
| 64 | 64 | return $this; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - return (float)$value; |
|
| 90 | + return (float) $value; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function toArray(): array |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $this->exclusiveMinimum = $match[2] == '<'; |
| 152 | - $this->minimum = $match[3] === '' ? null : (float)$match[3]; |
|
| 153 | - $this->maximum = $match[4] === '' ? null : (float)$match[4]; |
|
| 152 | + $this->minimum = $match[3] === '' ? null : (float) $match[3]; |
|
| 153 | + $this->maximum = $match[4] === '' ? null : (float) $match[4]; |
|
| 154 | 154 | $this->exclusiveMaximum = isset($match[5]) ? ($match[5] == '>') : null; |
| 155 | 155 | if ($this->minimum && $this->maximum && $this->minimum > $this->maximum) { |
| 156 | 156 | self::swap($this->minimum, $this->maximum); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | switch (strtolower($command)) { |
| 61 | 61 | case 'min': |
| 62 | - $this->minItems = (int)$data; |
|
| 62 | + $this->minItems = (int) $data; |
|
| 63 | 63 | if ($this->minItems < 0) { |
| 64 | 64 | throw new Exception("Minimum less than zero: '{$data}'"); |
| 65 | 65 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | return $this; |
| 70 | 70 | |
| 71 | 71 | case 'max': |
| 72 | - $this->maxItems = (int)$data; |
|
| 72 | + $this->maxItems = (int) $data; |
|
| 73 | 73 | if ($this->minItems !== null && $this->minItems > $this->maxItems) { |
| 74 | 74 | throw new Exception("Maximum less than minimum: '{$data}'"); |
| 75 | 75 | } |
@@ -182,8 +182,8 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | $exclusiveMinimum = $match[3] == '<'; |
| 185 | - $this->minItems = $match[4] === '' ? null : (int)$match[4]; |
|
| 186 | - $this->maxItems = $match[5] === '' ? null : (int)$match[5]; |
|
| 185 | + $this->minItems = $match[4] === '' ? null : (int) $match[4]; |
|
| 186 | + $this->maxItems = $match[5] === '' ? null : (int) $match[5]; |
|
| 187 | 187 | $exclusiveMaximum = isset($match[6]) ? ($match[6] == '>') : null; |
| 188 | 188 | if ($this->minItems && $this->maxItems && $this->minItems > $this->maxItems) { |
| 189 | 189 | self::swap($this->minItems, $this->maxItems); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public static function arrayFilterNull($array): array |
| 64 | 64 | { |
| 65 | - return array_filter($array, static function ($value) { |
|
| 65 | + return array_filter($array, static function($value) { |
|
| 66 | 66 | return $value !== null && $value !== []; |
| 67 | 67 | }); |
| 68 | 68 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public static function objectsToArray($array): array |
| 76 | 76 | { |
| 77 | - return array_map(static function (AbstractObject $item) { |
|
| 77 | + return array_map(static function(AbstractObject $item) { |
|
| 78 | 78 | return $item->toArray(); |
| 79 | 79 | }, $array); |
| 80 | 80 | } |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | if (!function_exists('yaml_emit')) { |
| 146 | 146 | throw new Exception('YAML extension not installed.'); |
| 147 | 147 | } |
| 148 | - array_walk_recursive($output, static function (&$value) { |
|
| 148 | + array_walk_recursive($output, static function(&$value) { |
|
| 149 | 149 | if (is_object($value)) { |
| 150 | - $value = (array)$value; |
|
| 150 | + $value = (array) $value; |
|
| 151 | 151 | } |
| 152 | 152 | }); |
| 153 | 153 | $output = yaml_emit($output, YAML_UTF8_ENCODING, YAML_LN_BREAK); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | if ($result !== $top) { |
| 220 | 220 | // Remove all similar classes from array first! |
| 221 | 221 | $classname = get_class($result); |
| 222 | - $stack = array_filter($stack, static function ($class) use ($classname) { |
|
| 222 | + $stack = array_filter($stack, static function($class) use ($classname) { |
|
| 223 | 223 | return !(is_a($class, $classname)); |
| 224 | 224 | }); |
| 225 | 225 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | $stacktrace = []; |
| 240 | 240 | foreach ($stack as $object) { |
| 241 | - $stacktrace[] = (string)$object; |
|
| 241 | + $stacktrace[] = (string) $object; |
|
| 242 | 242 | } |
| 243 | 243 | $messages[] = implode(', ' . PHP_EOL, $stacktrace); |
| 244 | 244 | |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | * @copyright 2014-2025 Martijn van der Lee |
| 13 | 13 | * @license https://opensource.org/licenses/MIT MIT |
| 14 | 14 | */ |
| 15 | -class TypeRegistry |
|
| 16 | -{
|
|
| 15 | +class TypeRegistry |
|
| 16 | +{ |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Map of format-name => class-name |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function add(string $classname): void |
| 31 | 31 | {
|
| 32 | - if (is_subclass_of($classname, ICustomType::class)) {
|
|
| 33 | - foreach ($classname::getFormats() as $format) {
|
|
| 32 | + if (is_subclass_of($classname, ICustomType::class)) { |
|
| 33 | + foreach ($classname::getFormats() as $format) { |
|
| 34 | 34 | $this->formats[$format] = $classname; |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @param string $name |
| 43 | 43 | */ |
| 44 | - public function remove($name) |
|
| 45 | - {
|
|
| 44 | + public function remove($name) |
|
| 45 | + { |
|
| 46 | 46 | $this->formats[$name] = null; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @return bool |
| 53 | 53 | */ |
| 54 | - public function has($name) |
|
| 55 | - {
|
|
| 54 | + public function has($name) |
|
| 55 | + { |
|
| 56 | 56 | return !empty($this->formats[$name]); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @return null|string |
| 63 | 63 | */ |
| 64 | - public function get($name) |
|
| 65 | - {
|
|
| 64 | + public function get($name) |
|
| 65 | + { |
|
| 66 | 66 | return !empty($this->formats[$name]) |
| 67 | 67 | ? $this->formats[$name] |
| 68 | 68 | : null; |