1 | <?php |
||||||
2 | declare(strict_types=1); |
||||||
3 | |||||||
4 | namespace Basster\LazyResponseBundle\Response\Handler; |
||||||
5 | |||||||
6 | use Basster\LazyResponseBundle\Response\LazyResponseInterface; |
||||||
7 | use Basster\LazyResponseBundle\Response\RedirectResponse; |
||||||
8 | use Symfony\Component\HttpFoundation\RedirectResponse as SymfonyRedirectResponse; |
||||||
9 | use Symfony\Component\HttpFoundation\Response; |
||||||
10 | use Symfony\Component\Routing\RouterInterface; |
||||||
11 | |||||||
12 | /** |
||||||
13 | * Class RedirectResponseHandler. |
||||||
14 | */ |
||||||
15 | final class RedirectResponseHandler extends AbstractLazyResponseHandler |
||||||
16 | { |
||||||
17 | 4 | public function __construct(private RouterInterface $router) |
|||||
0 ignored issues
–
show
|
|||||||
18 | { |
||||||
19 | 4 | } |
|||||
20 | |||||||
21 | 3 | protected function isSupported(LazyResponseInterface $controllerResult): bool |
|||||
22 | { |
||||||
23 | 3 | return $controllerResult instanceof RedirectResponse; |
|||||
24 | } |
||||||
25 | |||||||
26 | /** |
||||||
27 | * @param RedirectResponse $controllerResult |
||||||
28 | * |
||||||
29 | * @psalm-suppress MoreSpecificImplementedParamType |
||||||
30 | */ |
||||||
31 | 3 | protected function generateResponse(LazyResponseInterface $controllerResult): Response |
|||||
32 | { |
||||||
33 | 3 | return new SymfonyRedirectResponse( |
|||||
34 | 3 | $this->router->generate( |
|||||
35 | 3 | $controllerResult->getRouteName(), |
|||||
0 ignored issues
–
show
The method
getRouteName() does not exist on Basster\LazyResponseBund...e\LazyResponseInterface . It seems like you code against a sub-type of Basster\LazyResponseBund...e\LazyResponseInterface such as Basster\LazyResponseBund...sponse\RedirectResponse .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
36 | 3 | $controllerResult->getRouteParams() |
|||||
0 ignored issues
–
show
The method
getRouteParams() does not exist on Basster\LazyResponseBund...e\LazyResponseInterface . It seems like you code against a sub-type of Basster\LazyResponseBund...e\LazyResponseInterface such as Basster\LazyResponseBund...sponse\RedirectResponse .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
37 | ), |
||||||
38 | 3 | $controllerResult->getStatusCode(), |
|||||
39 | 3 | $controllerResult->getHeaders() |
|||||
0 ignored issues
–
show
The method
getHeaders() does not exist on Basster\LazyResponseBund...e\LazyResponseInterface . Since it exists in all sub-types, consider adding an abstract or default implementation to Basster\LazyResponseBund...e\LazyResponseInterface .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
40 | ); |
||||||
41 | } |
||||||
42 | } |
||||||
43 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.