Completed
Pull Request — master (#2775)
by Jeroen
10:25
created

DataCollectorTranslator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 10
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
1
<?php
2
3
namespace Kunstmaan\TranslatorBundle\Toolbar;
4
5
use Symfony\Component\Translation\TranslatorInterface;
6
use Symfony\Component\Translation\DataCollectorTranslator as BaseDataCollectorTranslator;
7
8
/**
9
 * Class DataCollectorTranslator
10
 */
11
class DataCollectorTranslator extends BaseDataCollectorTranslator
12
{
13
    /**
14
     * @param TranslatorInterface $translator The translator must implement TranslatorBagInterface
15
     */
16
    public function __construct(TranslatorInterface $translator)
17
    {
18
        parent::__construct($translator);
0 ignored issues
show
Documentation introduced by
$translator is of type object<Symfony\Component...on\TranslatorInterface>, but the function expects a object<Symfony\Contracts...on\TranslatorInterface>.

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...
19
    }
20
}
21