Completed
Push — app ( 14394a...905ced )
by Akihito
02:47
created

AbstractAppModule::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * This file is part of the BEAR.Package package.
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace BEAR\Package;
8
9
use BEAR\AppMeta\AbstractAppMeta;
10
use BEAR\Sunday\Extension\Application\AbstractApp;
11
use Ray\Di\AbstractModule;
12
13
class AbstractAppModule extends AbstractModule
14
{
15
    /**
16
     * @var AbstractAppMeta
17
     */
18
    private $app;
19
20
    public function __construct(AbstractAppMeta $app)
21
    {
22
        $this->app = $app->name . '\Module\App';
0 ignored issues
show
Documentation Bug introduced by
It seems like $app->name . '\\Module\\App' of type string is incompatible with the declared type object<BEAR\AppMeta\AbstractAppMeta> of property $app.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
23
        parent::__construct();
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    protected function configure()
30
    {
31
        // bind default app class name
32
        $this->bind(AbstractApp::class)->to($this->app);
0 ignored issues
show
Documentation introduced by
$this->app is of type object<BEAR\AppMeta\AbstractAppMeta>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
33
    }
34
}
35