Completed
Pull Request — 1.x (#330)
by Akihito
02:57
created

DiCompileModule   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 21
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A configure() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Package\Provide\Boot;
6
7
use Ray\Di\AbstractModule;
8
9
class DiCompileModule extends AbstractModule
10
{
11
    /**
12
     * @var bool
13
     */
14
    private $doCompile;
15
16
    public function __construct(bool $doCompile, AbstractModule $module = null)
17
    {
18
        $this->doCompile = $doCompile;
19
        parent::__construct($module);
0 ignored issues
show
Bug introduced by
It seems like $module defined by parameter $module on line 16 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...
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    protected function configure() : void
26
    {
27
        $this->bind()->annotatedWith(self::class)->toInstance($this->doCompile);
28
    }
29
}
30