TwitalFormulaLoader::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Goetas\TwitalBundle\Assetic;
4
5
use Assetic\Extension\Twig\TwigFormulaLoader;
6
use Assetic\Factory\Resource\ResourceInterface;
7
use Goetas\Twital\TwitalLoader;
8
use Goetas\TwitalBundle\Assetic\Resource\TwitalResource;
9
use Twig\Environment;
10
11
/**
12
 *
13
 * @author Asmir Mustafic <[email protected]>
14
 *
15
 */
16
class TwitalFormulaLoader extends TwigFormulaLoader
17
{
18
19
    private $twital;
20 1
21
    public function __construct(TwitalLoader $twital, Environment $twig)
22 1
    {
23 1
        $this->twital = $twital;
24 1
        parent::__construct($twig);
0 ignored issues
show
Documentation introduced by
$twig is of type object<Twig\Environment>, but the function expects a object<Twig_Environment>.

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...
25
    }
26 1
27
    public function load(ResourceInterface $resource)
28 1
    {
29
        return parent::load(new TwitalResource($this->twital, $resource));
30
    }
31
}
32