|
@@ -172,7 +172,7 @@ discard block |
|
|
block discarded – undo |
|
172
|
172
|
*/ |
|
173
|
173
|
final public static function all(array $values = [], bool $reverse = false, string $property = 'id'): array |
|
174
|
174
|
{ |
|
175
|
|
- $values = array_map(static function ($value) { |
|
|
175
|
+ $values = array_map(static function($value) { |
|
176
|
176
|
return $value instanceof Enum ? $value->getId() : $value; |
|
177
|
177
|
}, $values); |
|
178
|
178
|
|
|
@@ -188,7 +188,7 @@ discard block |
|
|
block discarded – undo |
|
188
|
188
|
$values = $reverse ? array_values(array_diff($all, $values)) : $values; |
|
189
|
189
|
} |
|
190
|
190
|
|
|
191
|
|
- return array_map(static function ($id) use ($property) { |
|
|
191
|
+ return array_map(static function($id) use ($property) { |
|
192
|
192
|
return 'id' === $property ? static::create($id) : static::from($property, $id); |
|
193
|
193
|
}, $values); |
|
194
|
194
|
} |
|
@@ -257,11 +257,11 @@ discard block |
|
|
block discarded – undo |
|
257
|
257
|
|
|
258
|
258
|
foreach ($reflection->getReflectionConstants() as $reflectionConstant) { |
|
259
|
259
|
if (false === $reflectionConstant->isPrivate()) { |
|
260
|
|
- throw new LogicException(sprintf('Constant "%s" of class "%s" must be private by design.', $reflectionConstant->getName(), static::class, )); |
|
|
260
|
+ throw new LogicException(sprintf('Constant "%s" of class "%s" must be private by design.', $reflectionConstant->getName(), static::class,)); |
|
261
|
261
|
} |
|
262
|
262
|
|
|
263
|
263
|
if (!is_int($reflectionConstant->getValue())) { |
|
264
|
|
- throw new LogicException(sprintf('Constants "%s" of class "%s" must be type of integer by design.', $reflectionConstant->getName(), static::class, )); |
|
|
264
|
+ throw new LogicException(sprintf('Constants "%s" of class "%s" must be type of integer by design.', $reflectionConstant->getName(), static::class,)); |
|
265
|
265
|
} |
|
266
|
266
|
} |
|
267
|
267
|
|
|
@@ -271,11 +271,11 @@ discard block |
|
|
block discarded – undo |
|
271
|
271
|
self::$properties[static::class][$property->getName()] = $property; |
|
272
|
272
|
|
|
273
|
273
|
if ($property->isPublic()) { |
|
274
|
|
- throw new LogicException(sprintf('Property "%s" of class "%s" must be private or protected by design.', $property->getName(), static::class, )); |
|
|
274
|
+ throw new LogicException(sprintf('Property "%s" of class "%s" must be private or protected by design.', $property->getName(), static::class,)); |
|
275
|
275
|
} |
|
276
|
276
|
|
|
277
|
277
|
if (!$property->isStatic()) { |
|
278
|
|
- throw new LogicException(sprintf('Property "%s" of class "%s" must be static by design.', $property->getName(), static::class, )); |
|
|
278
|
+ throw new LogicException(sprintf('Property "%s" of class "%s" must be static by design.', $property->getName(), static::class,)); |
|
279
|
279
|
} |
|
280
|
280
|
|
|
281
|
281
|
if (array_values($constants) !== array_keys($property->getValue())) { |