Completed
Pull Request — 2.x (#216)
by Akihito
09:47
created

DiCompileModule::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\Compiler;
6
7
use Ray\Compiler\Annotation\Compile;
8
use Ray\Di\AbstractModule;
9
10
class DiCompileModule extends AbstractModule
11
{
12
    /**
13
     * @var bool
14
     */
15
    private $doCompile;
16
17
    public function __construct(bool $doCompile, AbstractModule $module = null)
18
    {
19
        $this->doCompile = $doCompile;
20
        parent::__construct($module);
0 ignored issues
show
Bug introduced by
It seems like $module defined by parameter $module on line 17 can also be of type object<Ray\Di\AbstractModule>; however, Ray\Di\AbstractModule::__construct() does only seem to accept null|object<self>, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected function configure() : void
27
    {
28
        $this->bind()->annotatedWith(Compile::class)->toInstance($this->doCompile);
29
    }
30
}
31