Test Failed
Pull Request — master (#941)
by Aleksei
09:19
created

DeferredFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Core\Config;
6
7
/**
8
 * Factory that can be resolved later.
9
 */
10
final class DeferredFactory extends Binding
11
{
12
    /**
13
     * @param array{0: object|non-empty-string, 1: non-empty-string, ...} $factory
0 ignored issues
show
Documentation Bug introduced by
The doc comment object|non-empty-string, 1: non-empty-string, at position 2 could not be parsed: Unknown type name 'non-empty-string' at position 2 in object|non-empty-string, 1: non-empty-string,.
Loading history...
14
     */
15
    public function __construct(
16
        public readonly array $factory,
17
        public readonly bool $singleton = false,
18
    ) {
19
    }
20
21
    public function __toString(): string
22
    {
23
        return sprintf(
24
            "Deferred factory '%s'->%s()",
25
            \is_string($this->factory[0]) ? $this->factory[0] : \get_debug_type($this->factory[0]),
26
            $this->factory[1],
27
        );
28
    }
29
}
30