These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Configuration file for DI container. |
||
4 | */ |
||
5 | return [ |
||
6 | |||
7 | // Services to add to the container. |
||
8 | 1 | "services" => [ |
|
9 | "content" => [ |
||
10 | "shared" => true, |
||
11 | "callback" => function () { |
||
12 | 1 | $content = new \Anax\Content\FileBasedContent(); |
|
13 | 1 | $content->setDI($this); |
|
0 ignored issues
–
show
|
|||
14 | |||
15 | // Load the configuration files |
||
16 | 1 | $cfg = $this->get("configuration"); |
|
17 | 1 | $config = $cfg->load("content.php"); |
|
18 | 1 | $config = $config["config"] ?? null; |
|
19 | 1 | $file = $config["file"] ?? null; |
|
0 ignored issues
–
show
$file is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the
Loading history...
|
|||
20 | |||
21 | 1 | $content->configure($config); |
|
22 | |||
23 | 1 | return $content; |
|
24 | 1 | } |
|
25 | ], |
||
26 | ], |
||
27 | ]; |
||
28 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.