| Total Complexity | 7 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | final class ValueGenerator implements ValueGeneratorInterface |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @var callable():T|T|class-string<T> |
||
| 24 | */ |
||
| 25 | private $value; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var callable():T|T|class-string<T>|null |
||
| 29 | */ |
||
| 30 | private $attachment; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * ValueGenerator constructor. |
||
| 34 | * |
||
| 35 | * @param callable():T|T|class-string<T> $value |
||
| 36 | */ |
||
| 37 | 257 | public function __construct($value = []) |
|
| 38 | { |
||
| 39 | /** @psalm-suppress PropertyTypeCoercion */ |
||
| 40 | 257 | $this->value = $value; |
|
| 41 | 257 | } |
|
| 42 | |||
| 43 | /** |
||
| 44 | * {@inheritdoc} |
||
| 45 | */ |
||
| 46 | 25 | public function attach($entity): void |
|
| 50 | 25 | } |
|
| 51 | |||
| 52 | /** |
||
| 53 | * {@inheritdoc} |
||
| 54 | */ |
||
| 55 | 44 | public function generate(ElementInterface $element) |
|
| 76 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: