|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace BEAR\Package; |
|
6
|
|
|
|
|
7
|
|
|
use BEAR\AppMeta\Meta; |
|
8
|
|
|
use BEAR\Package\Injector\PackageInjector; |
|
9
|
|
|
use Ray\Di\AbstractModule; |
|
10
|
|
|
use Ray\Di\InjectorInterface; |
|
11
|
|
|
use Ray\PsrCacheModule\LocalCacheProvider; |
|
12
|
|
|
use Symfony\Contracts\Cache\CacheInterface; |
|
13
|
|
|
|
|
14
|
|
|
use function str_replace; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @see PackageInjector |
|
18
|
|
|
* @psalm-import-type AppName from Types |
|
19
|
|
|
* @psalm-import-type Context from Types |
|
20
|
|
|
* @psalm-import-type AppDir from Types |
|
21
|
|
|
*/ |
|
22
|
|
|
final class Injector |
|
23
|
|
|
{ |
|
24
|
|
|
/** @codeCoverageIgnore */ |
|
25
|
|
|
private function __construct() |
|
26
|
|
|
{ |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @param AppName $appName |
|
|
|
|
|
|
31
|
|
|
* @param Context $context |
|
32
|
|
|
* @param AppDir $appDir |
|
|
|
|
|
|
33
|
|
|
*/ |
|
34
|
|
|
public static function getInstance(string $appName, string $context, string $appDir, CacheInterface|null $cache = null): InjectorInterface |
|
35
|
|
|
{ |
|
36
|
|
|
$meta = new Meta($appName, $context, $appDir); |
|
37
|
|
|
$cacheNamespace = str_replace('\\', '_', $appName) . $context; |
|
38
|
|
|
$cache ??= (new LocalCacheProvider($meta->tmpDir . '/injector', $cacheNamespace))->get(); |
|
39
|
|
|
|
|
40
|
|
|
return PackageInjector::getInstance($meta, $context, $cache); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @param AppName $appName |
|
45
|
|
|
* @param Context $context |
|
46
|
|
|
* @param AppDir $appDir |
|
47
|
|
|
*/ |
|
48
|
|
|
public static function getOverrideInstance(string $appName, string $context, string $appDir, AbstractModule $overrideModule): InjectorInterface |
|
49
|
|
|
{ |
|
50
|
|
|
return PackageInjector::factory(new Meta($appName, $context, $appDir), $context, $overrideModule); |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|
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