1 | <?php |
||||||
2 | |||||||
3 | namespace Nip\Http\Kernel; |
||||||
4 | |||||||
5 | use Exception; |
||||||
6 | use Nip\Application\ApplicationInterface; |
||||||
7 | use Nip\Dispatcher\ActionDispatcherMiddleware; |
||||||
0 ignored issues
–
show
|
|||||||
8 | use Nip\Http\Kernel\Traits\HandleExceptionsTrait; |
||||||
0 ignored issues
–
show
The type
Nip\Http\Kernel\Traits\HandleExceptionsTrait 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 ![]() |
|||||||
9 | use Nip\Http\Response\Response; |
||||||
10 | use Nip\Http\ServerMiddleware\Dispatcher; |
||||||
11 | use Nip\Http\ServerMiddleware\Traits\HasServerMiddleware; |
||||||
12 | use Nip\Request; |
||||||
13 | use Nip\Router\Middleware\RouteResolverMiddleware; |
||||||
14 | use Nip\Router\Router; |
||||||
15 | use Nip\Session\Middleware\StartSession; |
||||||
0 ignored issues
–
show
The type
Nip\Session\Middleware\StartSession 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 ![]() |
|||||||
16 | use Psr\Http\Message\RequestInterface; |
||||||
17 | use Psr\Http\Message\ResponseInterface; |
||||||
18 | use Psr\Http\Message\ServerRequestInterface; |
||||||
19 | use Symfony\Component\ErrorHandler\Error\FatalError; |
||||||
20 | use Symfony\Component\HttpFoundation\Request as SymfonyRequest; |
||||||
21 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
||||||
22 | use Symfony\Component\HttpKernel\HttpKernelInterface; |
||||||
23 | use Throwable; |
||||||
24 | |||||||
25 | /** |
||||||
26 | * Class Kernel |
||||||
27 | * @package Nip\Http\Kernel |
||||||
28 | */ |
||||||
29 | class Kernel implements KernelInterface |
||||||
30 | { |
||||||
31 | use Traits\HandleExceptions; |
||||||
32 | use Traits\HasApplication; |
||||||
33 | |||||||
34 | use HasServerMiddleware; |
||||||
35 | |||||||
36 | /** |
||||||
37 | * The router instance. |
||||||
38 | * |
||||||
39 | * @var Router |
||||||
40 | */ |
||||||
41 | protected $router; |
||||||
42 | |||||||
43 | /** |
||||||
44 | * The application's route middleware groups. |
||||||
45 | * |
||||||
46 | * @var array |
||||||
47 | */ |
||||||
48 | protected $middlewareGroups = []; |
||||||
49 | |||||||
50 | /** |
||||||
51 | * The application's route middleware. |
||||||
52 | * |
||||||
53 | * @var array |
||||||
54 | */ |
||||||
55 | protected $routeMiddleware = []; |
||||||
56 | |||||||
57 | /** |
||||||
58 | * Create a new HTTP kernel instance. |
||||||
59 | * |
||||||
60 | * @param ApplicationInterface $app |
||||||
61 | * @param Router $router |
||||||
62 | */ |
||||||
63 | public function __construct(ApplicationInterface $app, Router $router) |
||||||
64 | { |
||||||
65 | $this->app = $app; |
||||||
0 ignored issues
–
show
It seems like
$app of type Nip\Application\ApplicationInterface is incompatible with the declared type Nip\Application of property $app .
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.. ![]() |
|||||||
66 | $this->router = $router; |
||||||
67 | |||||||
68 | $this->pushMiddleware(StartSession::class); |
||||||
69 | $this->pushMiddleware(RouteResolverMiddleware::class); |
||||||
70 | $this->pushMiddleware(ActionDispatcherMiddleware::class); |
||||||
71 | } |
||||||
72 | |||||||
73 | /** |
||||||
74 | * Handle an incoming HTTP request. |
||||||
75 | * |
||||||
76 | * @param SymfonyRequest $request |
||||||
77 | * @param int $type |
||||||
78 | * @param bool $catch |
||||||
79 | * @return ResponseInterface |
||||||
80 | */ |
||||||
81 | public function handle( |
||||||
82 | SymfonyRequest $request, |
||||||
83 | int $type = HttpKernelInterface::MAIN_REQUEST, |
||||||
84 | bool $catch = true |
||||||
85 | ): \Symfony\Component\HttpFoundation\Response { |
||||||
86 | try { |
||||||
87 | $this->getApplication()->share('request', $request); |
||||||
88 | return $this->handleRaw($request, $type); |
||||||
0 ignored issues
–
show
$request of type Symfony\Component\HttpFoundation\Request is incompatible with the type Psr\Http\Message\ServerRequestInterface expected by parameter $request of Nip\Http\Kernel\Kernel::handleRaw() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
89 | } catch (Exception $e) { |
||||||
90 | $this->reportException($e); |
||||||
91 | $response = $this->renderException($request, $e); |
||||||
92 | } catch (Throwable $e) { |
||||||
93 | $this->reportException($e); |
||||||
94 | $response = $this->renderException($request, $e); |
||||||
95 | } |
||||||
96 | // event(new Events\RequestHandled($request, $response)); |
||||||
97 | return $response; |
||||||
0 ignored issues
–
show
|
|||||||
98 | } |
||||||
99 | |||||||
100 | /** |
||||||
101 | * Handles a request to convert it to a response. |
||||||
102 | * |
||||||
103 | * @param ServerRequestInterface $request A Request instance |
||||||
104 | * @param int $type The type of the request |
||||||
105 | * |
||||||
106 | * @return ResponseInterface A Response instance |
||||||
107 | * |
||||||
108 | * @throws \LogicException If one of the listener does not behave as expected |
||||||
109 | * @throws NotFoundHttpException When controller cannot be found |
||||||
110 | */ |
||||||
111 | protected function handleRaw(ServerRequestInterface $request, $type = self::MASTER_REQUEST) |
||||||
0 ignored issues
–
show
The constant
Symfony\Component\HttpKe...terface::MASTER_REQUEST has been deprecated: since symfony/http-kernel 5.3, use MAIN_REQUEST instead. To ease the migration, this constant won't be removed until Symfony 7.0.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This class constant has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead. ![]() The parameter
$type is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
112 | { |
||||||
113 | return ( |
||||||
114 | new Dispatcher($this->middleware, $this->getApplication()->getContainer()) |
||||||
115 | )->dispatch($request); |
||||||
116 | } |
||||||
117 | |||||||
118 | /** |
||||||
119 | * @param Request $request |
||||||
120 | * @param Response $response |
||||||
121 | */ |
||||||
122 | public function terminate(RequestInterface $request, ResponseInterface $response) |
||||||
123 | { |
||||||
124 | $this->terminateMiddleware($request, $response); |
||||||
125 | $this->getApplication()->terminate(); |
||||||
126 | } |
||||||
127 | |||||||
128 | public function postRouting() |
||||||
129 | { |
||||||
130 | } |
||||||
131 | } |
||||||
132 |
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