1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace BEAR\Package\Compiler; |
||
6 | |||
7 | use BEAR\AppMeta\AbstractAppMeta; |
||
8 | use BEAR\Package\Injector; |
||
9 | use BEAR\Resource\ResourceInterface; |
||
10 | use BEAR\Sunday\Extension\Router\RouterInterface; |
||
11 | use BEAR\Sunday\Extension\Transfer\HttpCacheInterface; |
||
12 | use BEAR\Sunday\Extension\Transfer\TransferInterface; |
||
13 | use Throwable; |
||
14 | |||
15 | use function assert; |
||
16 | |||
17 | /** |
||
18 | * @psalm-import-type Globals from RouterInterface |
||
19 | * @psalm-import-type Server from RouterInterface |
||
20 | */ |
||
21 | |||
22 | final class Bootstrap |
||
23 | { |
||
24 | private string $appDir; |
||
25 | |||
26 | public function __construct(AbstractAppMeta $meta) |
||
27 | { |
||
28 | $this->appDir = $meta->appDir; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @param Globals $globals |
||
0 ignored issues
–
show
|
|||
33 | * @param Server $server |
||
0 ignored issues
–
show
The type
BEAR\Package\Compiler\Server 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 ![]() |
|||
34 | * |
||
35 | * @return 0|1 |
||
0 ignored issues
–
show
|
|||
36 | */ |
||
37 | public function __invoke(string $appName, string $context, array $globals, array $server): int |
||
38 | { |
||
39 | $injector = Injector::getInstance($appName, $context, $this->appDir); |
||
40 | $injector->getInstance(HttpCacheInterface::class); |
||
41 | $router = $injector->getInstance(RouterInterface::class); |
||
42 | assert($router instanceof RouterInterface); |
||
43 | $request = $router->match($globals, $server); |
||
44 | try { |
||
45 | /** @psalm-suppress all */ |
||
46 | $resource = $injector->getInstance(ResourceInterface::class); |
||
47 | $resource->{$request->method}->uri($request->path)($request->query); |
||
48 | } catch (Throwable) { |
||
49 | $injector->getInstance(TransferInterface::class); |
||
50 | |||
51 | return 1; |
||
52 | } |
||
53 | |||
54 | // @codeCoverageIgnoreStart |
||
55 | return 0; |
||
56 | // @codeCoverageIgnoreEnd |
||
57 | } |
||
58 | } |
||
59 |
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