Issues (248)

src/Spinner/bootstrap.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AlecRabbit\Spinner;
6
7
use AlecRabbit\Spinner\Container\Contract\IServiceDefinition;
8
use AlecRabbit\Spinner\Container\DefinitionRegistry;
9
use AlecRabbit\Spinner\Container\ServiceDefinition;
0 ignored issues
show
The type AlecRabbit\Spinner\Container\ServiceDefinition was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use AlecRabbit\Spinner\Core\Probe\SignalHandlingProbe;
11
use AlecRabbit\Spinner\Core\Probe\StylingMethodProbe;
12
use AlecRabbit\Spinner\Exception\InvalidArgument;
13
14
use function AlecRabbit\Spinner\Root\getDefinitions;
15
16
// @codeCoverageIgnoreStart
17
require_once __DIR__ . '/Root/definitions.php';
18
19
Probes::register(
20
    SignalHandlingProbe::class,
21
    StylingMethodProbe::class,
22
);
23
24
$registry = DefinitionRegistry::getInstance();
25
26
/**
27
 * @var string|int $id
28
 * @var callable|object|class-string|IServiceDefinition $definition
29
 */
30
foreach (getDefinitions() as $id => $definition) {
31
    if ($definition instanceof IServiceDefinition) {
32
        $registry->bind($definition);
33
        continue;
34
    }
35
36
    if (!is_string($id)) {
37
        throw new InvalidArgument(
38
            sprintf(
39
                'Id must be a string, "%s" given.',
40
                get_debug_type($id)
41
            )
42
        );
43
    }
44
    $registry->bind(
45
        new ServiceDefinition(
46
            $id,
47
            $definition,
48
            IServiceDefinition::TRANSIENT
49
        )
50
    );
51
}
52
// @codeCoverageIgnoreEnd
53