| Total Complexity | 8 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | class EnumAbstractFactory implements AbstractFactoryInterface |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var array<class-string<BackedEnum>, PhpEnumType> |
||
|
1 ignored issue
–
show
|
|||
| 21 | */ |
||
| 22 | private array $cache = []; |
||
| 23 | |||
| 24 | public function canCreate(ContainerInterface $container, $requestedName) |
||
| 29 | } |
||
| 30 | |||
| 31 | public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null) |
||
| 32 | { |
||
| 33 | $class = $this->getClass($requestedName); |
||
| 34 | if (!$class) { |
||
| 35 | throw new Exception('Cannot create a PhpEnumType for a name not matching a backed enum: ' . $requestedName); |
||
| 36 | } |
||
| 37 | |||
| 38 | // Share the same instance between short name and FQCN |
||
| 39 | if (!array_key_exists($class, $this->cache)) { |
||
| 40 | $this->cache[$class] = new PhpEnumType($class); |
||
| 41 | } |
||
| 42 | |||
| 43 | return $this->cache[$class]; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return null|class-string<BackedEnum> |
||
|
1 ignored issue
–
show
|
|||
| 48 | */ |
||
| 49 | private function getClass(string $requestedName): ?string |
||
| 63 | } |
||
| 64 | } |
||
| 65 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths