Test Failed
Push — master ( a0eed4...bb00ac )
by Kirill
149:40
created

Generator::generate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 2
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\SDL\Backend;
11
12
use Psr\Log\LoggerAwareInterface;
13
use Psr\Log\LoggerAwareTrait;
14
use Railt\Io\Readable;
15
use Railt\Reflection\Document;
16
use Railt\Reflection\Contracts\Reflection;
17
18
/**
19
 * Class Generator
20
 */
21
class Generator implements LoggerAwareInterface
22
{
23
    use LoggerAwareTrait;
24
25
    /**
26
     * @var Reflection
27
     */
28
    private $reflection;
29
30
    /**
31
     * Generator constructor.
32
     * @param Reflection $reflection
33
     */
34
    public function __construct(Reflection $reflection)
35
    {
36
        $this->reflection = $reflection;
37
    }
38
39
    /**
40
     * @param Readable $file
41
     * @param iterable $ir
42
     * @return Document
43
     */
44
    public function generate(Readable $file, iterable $ir): Document
45
    {
46
        foreach ($ir as $documents) {
47
            ///
48
        }
49
50
        $document = new Document($this->reflection, $file);
0 ignored issues
show
Compatibility introduced by
$this->reflection of type object<Railt\Reflection\Contracts\Reflection> is not a sub-type of object<Railt\Reflection\Reflection>. It seems like you assume a concrete implementation of the interface Railt\Reflection\Contracts\Reflection to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
51
52
        return $document;
53
    }
54
}
55