| Conditions | 6 |
| Paths | 6 |
| Total Lines | 27 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 6.0045 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 5 | public function resolvePropertyValue(\ReflectionProperty $property) |
|
| 27 | { |
||
| 28 | 5 | $propertyType = $property->getType(); |
|
|
|
|||
| 29 | 5 | Assert::isInstanceOf($propertyType, \ReflectionNamedType::class); |
|
| 30 | |||
| 31 | 5 | switch ($propertyType->getName()) { |
|
| 32 | 5 | case 'string': |
|
| 33 | try { |
||
| 34 | 2 | $value = $this->faker->{$property->getName()}; |
|
| 35 | 2 | } catch (\Throwable $t) { |
|
| 36 | 2 | $value = $this->faker->word; |
|
| 37 | } |
||
| 38 | 2 | break; |
|
| 39 | 4 | case 'int': |
|
| 40 | 2 | $value = $this->faker->randomDigit; |
|
| 41 | 2 | break; |
|
| 42 | 3 | case 'bool': |
|
| 43 | 2 | $value = $this->faker->boolean; |
|
| 44 | 2 | break; |
|
| 45 | 2 | case 'DateTime': |
|
| 46 | 2 | $value = $this->faker->dateTime->format('Y-m-d H:i'); |
|
| 47 | 2 | break; |
|
| 48 | default: |
||
| 49 | $value = null; |
||
| 50 | } |
||
| 51 | |||
| 52 | 5 | return $value; |
|
| 53 | } |
||
| 55 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.