Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | 12 | public static function createFor(\ReflectionProperty $property, string $annotationClass, \Throwable $e): static |
|
10 | { |
||
11 | 12 | $column = new \ReflectionClass($annotationClass); |
|
12 | |||
13 | 12 | $requiredArguments = []; |
|
14 | 12 | foreach ($column->getConstructor()->getParameters() as $parameter) { |
|
15 | 12 | if (! $parameter->isOptional()) { |
|
16 | 12 | $requiredArguments[] = $parameter->getName(); |
|
17 | } |
||
18 | } |
||
19 | |||
20 | 12 | return new static( |
|
21 | 12 | sprintf( |
|
22 | 12 | 'Some of required arguments [`%s`] is missed on `%s.%s.`', |
|
23 | 12 | implode('`, `', $requiredArguments), |
|
24 | 12 | $property->getDeclaringClass()->getName(), |
|
25 | 12 | $property->getName() |
|
26 | ), |
||
27 | 12 | $e->getCode(), |
|
28 | $e |
||
29 | ); |
||
32 |