ray-di /
Ray.Di
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Ray\Di; |
||
| 6 | |||
| 7 | use Ray\Aop\Compiler; |
||
| 8 | |||
| 9 | use function array_shift; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @psalm-import-type ModuleList from Types |
||
| 13 | * @psalm-import-type ScriptDir from Types |
||
| 14 | */ |
||
| 15 | final class ContainerFactory |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @param AbstractModule|ModuleList|null $module Module(s) |
||
|
0 ignored issues
–
show
|
|||
| 19 | * @param ScriptDir $classDir |
||
|
0 ignored issues
–
show
The type
Ray\Di\ScriptDir was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 20 | */ |
||
| 21 | public function __invoke($module, string $classDir): Container |
||
| 22 | { |
||
| 23 | $oneModule = $this->getModule($module); |
||
| 24 | // install built-in module |
||
| 25 | $appModule = (new BuiltinModule())($oneModule); |
||
| 26 | $container = $appModule->getContainer(); |
||
| 27 | // Compile null objects |
||
| 28 | (new CompileNullObject())($container, $classDir); |
||
| 29 | // Compile aspects |
||
| 30 | /** @psalm-suppress InvalidArgument */ |
||
| 31 | $container->weaveAspects(new Compiler($classDir)); |
||
| 32 | |||
| 33 | return $container; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param AbstractModule|ModuleList|null $module Module(s) |
||
| 38 | */ |
||
| 39 | private function getModule($module): AbstractModule |
||
| 40 | { |
||
| 41 | if ($module instanceof AbstractModule) { |
||
| 42 | return $module; |
||
| 43 | } |
||
| 44 | |||
| 45 | if ($module === null) { |
||
|
0 ignored issues
–
show
|
|||
| 46 | return new NullModule(); |
||
| 47 | } |
||
| 48 | |||
| 49 | $modules = $module; |
||
| 50 | $oneModule = array_shift($modules); |
||
| 51 | foreach ($modules as $module) { |
||
|
0 ignored issues
–
show
|
|||
| 52 | $oneModule->install($module); |
||
| 53 | } |
||
| 54 | |||
| 55 | return $oneModule; |
||
| 56 | } |
||
| 57 | } |
||
| 58 |
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