Passed
Push — master ( 9eea33...054d19 )
by Mikael
05:44
created

config/di/content.php (2 issues)

Upgrade to new PHP Analysis Engine

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
The variable $this does not exist. Did you forget to declare it?

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.

Loading history...
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 $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
20
21 1
                $content->configure($config);
22
23 1
                return $content;
24 1
            }
25
        ],
26
    ],
27
];
28