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