Issues (105)

src/Router/Traits/HasMatcherTrait.php (2 issues)

Labels
Severity
1
<?php
2
declare(strict_types=1);
3
4
namespace Nip\Router\Router\Traits;
5
6
use \Symfony\Component\HttpFoundation\Request;
0 ignored issues
show
The type \Symfony\Component\HttpFoundation\Request 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Nip\Router\Route\Route;
8
use Psr\Http\Message\ServerRequestInterface;
9
10
/**
11
 * Trait HasMatcherTrait
12
 * @package Nip\Router\Router\Traits
13
 */
14
trait HasMatcherTrait
15
{
16
    /**
17
     * @param Request|ServerRequestInterface $request
18
     * @return array
19 2
     */
20
    public function matchRequest(Request $request): array
21 2
    {
22
        $return = parent::matchRequest($request);
23
        if (isset($return['_route'])) {
24
            $this->setCurrent($return['_route']);
0 ignored issues
show
It seems like setCurrent() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
            $this->/** @scrutinizer ignore-call */ 
25
                   setCurrent($return['_route']);
Loading history...
25
//            $this->setCurrent($this->getRoute($return['_route']));
26
        }
27
        return $return;
28
    }
29
}
30