| Total Complexity | 5 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | final class GacelaConfigFile |
||
| 8 | { |
||
| 9 | /** @var list<GacelaConfigItem> */ |
||
| 10 | private array $configItems = []; |
||
| 11 | |||
| 12 | /** @var array<class-string,class-string|callable> */ |
||
| 13 | private array $mappingInterfaces = []; |
||
| 14 | |||
| 15 | 27 | public static function withDefaults(): self |
|
| 16 | { |
||
| 17 | 27 | return (new self()) |
|
| 18 | 27 | ->setConfigItems([GacelaConfigItem::withDefaults()]); |
|
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param list<GacelaConfigItem> $configItems |
||
| 23 | */ |
||
| 24 | 29 | public function setConfigItems(array $configItems): self |
|
| 25 | { |
||
| 26 | 29 | $this->configItems = $configItems; |
|
|
|
|||
| 27 | |||
| 28 | 29 | return $this; |
|
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @return list<GacelaConfigItem> |
||
| 33 | */ |
||
| 34 | 29 | public function getConfigItems(): array |
|
| 35 | { |
||
| 36 | 29 | return $this->configItems; |
|
|
1 ignored issue
–
show
|
|||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param array<class-string,class-string|callable> $mappingInterfaces |
||
| 41 | */ |
||
| 42 | 6 | public function setMappingInterfaces(array $mappingInterfaces): self |
|
| 43 | { |
||
| 44 | 6 | $this->mappingInterfaces = $mappingInterfaces; |
|
| 45 | |||
| 46 | 6 | return $this; |
|
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Map interfaces to concrete classes or callable (which will be resolved on runtime). |
||
| 51 | * This is util to inject dependencies to Gacela services (such as Factories, for example) via their constructor. |
||
| 52 | * |
||
| 53 | * @return mixed |
||
| 54 | */ |
||
| 55 | 2 | public function getMappingInterface(string $key) |
|
| 58 | } |
||
| 59 | } |
||
| 60 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..