These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\MediaBundle\Tests\Form; |
||
4 | |||
5 | use Kunstmaan\NodeBundle\Form\Type\URLChooserType; |
||
6 | use Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser; |
||
7 | use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
||
8 | use Symfony\Component\EventDispatcher\EventDispatcher; |
||
9 | use Symfony\Component\Form\FormBuilder; |
||
10 | use Symfony\Component\Form\Forms; |
||
11 | use Symfony\Component\OptionsResolver\OptionsResolver; |
||
12 | |||
13 | /** |
||
14 | * AbstractTypeTestCase |
||
15 | */ |
||
16 | View Code Duplication | abstract class AbstractTypeTest extends WebTestCase |
|
17 | { |
||
18 | /** |
||
19 | * @var FormBuilder |
||
20 | */ |
||
21 | protected $builder; |
||
22 | |||
23 | /** |
||
24 | * @var EventDispatcher |
||
25 | */ |
||
26 | protected $dispatcher; |
||
27 | |||
28 | /** |
||
29 | * @var \Symfony\Component\Form\FormFactoryInterface |
||
30 | */ |
||
31 | protected $factory; |
||
32 | |||
33 | /** |
||
34 | * @var OptionsResolver |
||
35 | */ |
||
36 | protected $resolver; |
||
37 | |||
38 | /** |
||
39 | * Sets up the fixture, for example, opens a network connection. |
||
40 | * This method is called before a test is executed. |
||
41 | */ |
||
42 | protected function setUp() |
||
43 | { |
||
44 | $formFactoryBuilderInterface = Forms::createFormFactoryBuilder(); |
||
45 | $formFactoryBuilderInterface->addType(new URLChooserType()); |
||
46 | $formFactoryBuilderInterface->addTypeGuesser(new DoctrineOrmTypeGuesser($this->createMock('Doctrine\Common\Persistence\ManagerRegistry'))); |
||
47 | $this->factory = $formFactoryBuilderInterface->getFormFactory(); |
||
48 | $this->dispatcher = $this->createMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); |
||
49 | $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory); |
||
0 ignored issues
–
show
|
|||
50 | $this->resolver = new OptionsResolver(); |
||
51 | } |
||
52 | } |
||
53 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.