Issues (5)

src/FindInvalidRouteCalls.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Juddling\RouteChecker;
4
5
use Illuminate\Routing\Route;
0 ignored issues
show
The type Illuminate\Routing\Route 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...
6
use Illuminate\Support\Collection;
7
8
class FindInvalidRouteCalls extends FindInvalid
9
{
10
    /** @var Collection */
11
    protected $routeNames;
12
    protected $nameOfArgument = 'Route Names';
13
14
    public function __construct()
15
    {
16
        $this->routeNames = collect(\Route::getRoutes())
17
            ->map(function (Route $route) {
18
                return $route->getName();
19
            })->filter();
20
21
        parent::__construct();
22
    }
23
24
    protected function getFunctionName()
25
    {
26
        return 'route';
27
    }
28
29
    protected function check(string $routeName): bool
30
    {
31
        return $this->routeNames->contains($routeName);
32
    }
33
}
34