1 | <?php |
||||||
2 | |||||||
3 | declare(strict_types=1); |
||||||
4 | |||||||
5 | namespace Yiistack\Routing; |
||||||
6 | |||||||
7 | use Spiral\Tokenizer\ClassLocator; |
||||||
8 | use Symfony\Component\Finder\Finder; |
||||||
9 | use Yiisoft\Aliases\Aliases; |
||||||
10 | use Yiisoft\Di\Container; |
||||||
11 | use Yiisoft\Di\Support\ServiceProvider; |
||||||
0 ignored issues
–
show
|
|||||||
12 | use Yiistack\Annotated\AnnotationLoader; |
||||||
13 | |||||||
14 | class RoutingServiceProvider extends ServiceProvider |
||||||
15 | { |
||||||
16 | private array $controllersPaths; |
||||||
17 | |||||||
18 | public function __construct(array $paths = []) |
||||||
19 | { |
||||||
20 | $this->controllersPaths = $paths; |
||||||
21 | } |
||||||
22 | |||||||
23 | /** |
||||||
24 | * @psalm-suppress InaccessibleMethod |
||||||
25 | */ |
||||||
26 | public function register(Container $container): void |
||||||
27 | { |
||||||
28 | $aliases = $container->get(Aliases::class); |
||||||
29 | $paths = array_map(static fn ($path): string => $aliases->get($path), $this->controllersPaths); |
||||||
30 | $finder = (new Finder())->files()->in($paths)->name('*.php'); |
||||||
31 | $container->set(AnnotationLoader::class, new AnnotationLoader(new ClassLocator($finder))); |
||||||
0 ignored issues
–
show
The method
set() does not exist on Yiisoft\Di\Container .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
32 | } |
||||||
33 | } |
||||||
34 |
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