FirebaseModule::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Piotzkhider\FirebaseModule;
6
7
use Kreait\Firebase;
8
use Piotzkhider\FirebaseModule\Annotation\Credentials;
9
use Ray\Di\AbstractModule;
10
use Ray\Di\Scope;
11
12
class FirebaseModule extends AbstractModule
13
{
14
    /**
15
     * @var mixed
16
     */
17
    private $credentials;
18
19 5
    public function __construct($credentials, AbstractModule $module = null)
20
    {
21 5
        $this->credentials = $credentials;
22 5
        parent::__construct($module);
0 ignored issues
show
Bug introduced by
It seems like $module defined by parameter $module on line 19 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...
23 5
    }
24
25 5
    protected function configure(): void
26
    {
27 5
        $this->bind()->annotatedWith(Credentials::class)->toInstance($this->credentials);
28 5
        $this->bind(Firebase::class)->toProvider(FirebaseProvider::class)->in(Scope::SINGLETON);
29 5
    }
30
}
31