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\RedirectBundle\Controller; |
||
4 | |||
5 | use Kunstmaan\AdminListBundle\AdminList\Configurator\AdminListConfiguratorInterface; |
||
6 | use Kunstmaan\AdminListBundle\Controller\AdminListController; |
||
7 | use Kunstmaan\RedirectBundle\AdminList\RedirectAdminListConfigurator; |
||
8 | use Symfony\Component\HttpFoundation\Request; |
||
9 | use Symfony\Component\HttpFoundation\Response; |
||
10 | use Symfony\Component\Routing\Annotation\Route; |
||
11 | |||
12 | class RedirectAdminListController extends AdminListController |
||
13 | { |
||
14 | /** |
||
15 | * @var AdminListConfiguratorInterface |
||
16 | */ |
||
17 | private $configurator; |
||
18 | |||
19 | /** |
||
20 | * @return AdminListConfiguratorInterface |
||
21 | */ |
||
22 | public function getAdminListConfigurator() |
||
23 | { |
||
24 | if (!isset($this->configurator)) { |
||
25 | $this->configurator = new RedirectAdminListConfigurator($this->getEntityManager(), null, $this->container->get('kunstmaan_admin.domain_configuration')); |
||
0 ignored issues
–
show
$this->getEntityManager() of type object<Doctrine\Persistence\ObjectManager> is not a sub-type of object<Doctrine\ORM\EntityManager> . It seems like you assume a concrete implementation of the interface Doctrine\Persistence\ObjectManager to be always present.
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.
Loading history...
|
|||
26 | } |
||
27 | |||
28 | return $this->configurator; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * The index action |
||
33 | * |
||
34 | * @Route("/", name="kunstmaanredirectbundle_admin_redirect") |
||
35 | */ |
||
36 | public function indexAction(Request $request) |
||
37 | { |
||
38 | return parent::doIndexAction($this->getAdminListConfigurator(), $request); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * The add action |
||
43 | * |
||
44 | * @Route("/add", name="kunstmaanredirectbundle_admin_redirect_add", methods={"GET", "POST"}) |
||
45 | * |
||
46 | * @return Response |
||
47 | */ |
||
48 | public function addAction(Request $request) |
||
49 | { |
||
50 | return parent::doAddAction($this->getAdminListConfigurator(), null, $request); |
||
0 ignored issues
–
show
$this->getAdminListConfigurator() of type object<Kunstmaan\AdminLi...tConfiguratorInterface> is not a sub-type of object<Kunstmaan\AdminLi...tAdminListConfigurator> . It seems like you assume a concrete implementation of the interface Kunstmaan\AdminListBundl...stConfiguratorInterface to be always present.
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.
Loading history...
|
|||
51 | } |
||
52 | |||
53 | /** |
||
54 | * The edit action |
||
55 | * |
||
56 | * @param int $id |
||
57 | * |
||
58 | * @Route("/{id}", requirements={"id" = "\d+"}, name="kunstmaanredirectbundle_admin_redirect_edit", methods={"GET", "POST"}) |
||
59 | * |
||
60 | * @return Response |
||
61 | */ |
||
62 | public function editAction(Request $request, $id) |
||
63 | { |
||
64 | return parent::doEditAction($this->getAdminListConfigurator(), $id, $request); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * The delete action |
||
69 | * |
||
70 | * @param int $id |
||
71 | * |
||
72 | * @Route("/{id}/delete", requirements={"id" = "\d+"}, name="kunstmaanredirectbundle_admin_redirect_delete", methods={"GET", "POST"}) |
||
73 | * |
||
74 | * @return Response |
||
75 | */ |
||
76 | public function deleteAction(Request $request, $id) |
||
77 | { |
||
78 | return parent::doDeleteAction($this->getAdminListConfigurator(), $id, $request); |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * The export action |
||
83 | * |
||
84 | * @param string $_format |
||
85 | * |
||
86 | * @Route("/export.{_format}", requirements={"_format" = "csv|xlsx|ods"}, name="kunstmaanredirectbundle_admin_redirect_export", methods={"GET", "POST"}) |
||
87 | * |
||
88 | * @return Response |
||
89 | */ |
||
90 | public function exportAction(Request $request, $_format) |
||
91 | { |
||
92 | return parent::doExportAction($this->getAdminListConfigurator(), $_format, $request); |
||
93 | } |
||
94 | } |
||
95 |
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: