These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * The MIT License (MIT) |
||
7 | * |
||
8 | * Copyright (c) 2014-2018 Spomky-Labs |
||
9 | * |
||
10 | * This software may be modified and distributed under the terms |
||
11 | * of the MIT license. See the LICENSE file for details. |
||
12 | */ |
||
13 | |||
14 | namespace OAuth2Framework\ServerBundle\Routing; |
||
15 | |||
16 | use Symfony\Component\Config\Loader\LoaderInterface; |
||
17 | use Symfony\Component\Config\Loader\LoaderResolverInterface; |
||
18 | use Symfony\Component\Routing\Route; |
||
19 | use Symfony\Component\Routing\RouteCollection; |
||
20 | |||
21 | class RouteLoader implements LoaderInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var RouteCollection |
||
25 | */ |
||
26 | private $routes; |
||
27 | |||
28 | /** |
||
29 | * RouteLoader constructor. |
||
30 | */ |
||
31 | public function __construct() |
||
32 | { |
||
33 | $this->routes = new RouteCollection(); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param string $name The name of the route |
||
38 | * @param string $controllerId The controller service ID |
||
39 | * @param string $methodName The controller method name |
||
40 | * @param string $path The path pattern to match |
||
41 | * @param array $defaults An array of default parameter values |
||
42 | * @param array $requirements An array of requirements for parameters (regexes) |
||
43 | * @param array $options An array of options |
||
44 | * @param string $host The host pattern to match |
||
45 | * @param string|array $schemes A required URI scheme or an array of restricted schemes |
||
46 | * @param string|array $methods A required HTTP method or an array of restricted methods |
||
47 | * @param string $condition A condition that should evaluate to true for the route to match |
||
48 | */ |
||
49 | public function addRoute($name, $controllerId, $methodName, $path, array $defaults = [], array $requirements = [], array $options = [], $host = '', $schemes = [], $methods = [], $condition = '') |
||
50 | { |
||
51 | $defaults['_controller'] = \sprintf('%s:%s', $controllerId, $methodName); |
||
52 | $route = new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition); |
||
0 ignored issues
–
show
It seems like
$methods defined by parameter $methods on line 49 can also be of type array ; however, Symfony\Component\Routing\Route::__construct() does only seem to accept string|array<integer,string> , maybe add an additional type check?
This check looks at variables that have been passed in as parameters and are passed out again to other methods. If the outgoing method call has stricter type requirements than the method itself, an issue is raised. An additional type check may prevent trouble.
Loading history...
|
|||
53 | $this->routes->add(\sprintf('oauth2_server_%s', $name), $route); |
||
54 | } |
||
55 | |||
56 | public function load($resource, $type = null) |
||
57 | { |
||
58 | return $this->routes; |
||
59 | } |
||
60 | |||
61 | public function supports($resource, $type = null) |
||
62 | { |
||
63 | return 'oauth2_server' === $type; |
||
64 | } |
||
65 | |||
66 | public function getResolver() |
||
67 | { |
||
68 | } |
||
69 | |||
70 | public function setResolver(LoaderResolverInterface $resolver) |
||
71 | { |
||
72 | } |
||
73 | } |
||
74 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.