1 | <?php |
||||
2 | |||||
3 | namespace Test; |
||||
4 | |||||
5 | use WorkCode\WCRouter\WCRouter; |
||||
0 ignored issues
–
show
|
|||||
6 | |||||
7 | class Name |
||||
8 | { |
||||
9 | /** @var WCRouter */ |
||||
10 | private $router; |
||||
11 | |||||
12 | public function __construct($router) |
||||
13 | { |
||||
14 | $this->router = $router; |
||||
15 | } |
||||
16 | |||||
17 | public function home(): void |
||||
18 | { |
||||
19 | echo "<h1>Home</h1>"; |
||||
20 | echo "<p>", $this->router->route("name.home"), "</p>"; |
||||
21 | echo "<p>", $this->router->route("name.hello"), "</p>"; |
||||
22 | echo "<p>", $this->router->route("name.redirect"), "</p>"; |
||||
23 | } |
||||
24 | |||||
25 | public function hello($data): void |
||||
0 ignored issues
–
show
The parameter
$data is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
26 | { |
||||
27 | echo "<h1>Hello World</h1>"; |
||||
28 | echo "<a href='{$this->router->route("name.params", ["category" => 6, "page" => 1])}'>Route Params</a>"; |
||||
29 | } |
||||
30 | |||||
31 | public function params(array $data): void |
||||
32 | { |
||||
33 | var_dump($data); |
||||
0 ignored issues
–
show
|
|||||
34 | } |
||||
35 | |||||
36 | public function redirect($data): void |
||||
37 | { |
||||
38 | if ($data) { |
||||
39 | //$data = category => *, page => * |
||||
40 | $this->router->redirect("name.params", $data); |
||||
41 | } |
||||
42 | |||||
43 | $this->router->redirect("name.hello"); |
||||
44 | } |
||||
45 | } |
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