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\MenuBundle\Service; |
||
4 | |||
5 | use Kunstmaan\AdminBundle\Helper\Menu\MenuAdaptorInterface; |
||
6 | use Kunstmaan\AdminBundle\Helper\Menu\MenuBuilder; |
||
7 | use Kunstmaan\AdminBundle\Helper\Menu\MenuItem; |
||
8 | use Kunstmaan\AdminBundle\Helper\Menu\TopMenuItem; |
||
9 | use Symfony\Component\HttpFoundation\Request; |
||
10 | |||
11 | class MenuAdaptor implements MenuAdaptorInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | private $menuNames; |
||
17 | |||
18 | public function __construct(array $menuNames) |
||
19 | { |
||
20 | $this->menuNames = $menuNames; |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * @param MenuItem $parent |
||
0 ignored issues
–
show
|
|||
25 | * @param Request $request |
||
26 | */ |
||
27 | public function adaptChildren(MenuBuilder $menu, array &$children, MenuItem $parent = null, Request $request = null) |
||
28 | { |
||
29 | if ((count($this->menuNames) > 0) && null !== $parent && 'KunstmaanAdminBundle_modules' === $parent->getRoute()) { |
||
30 | $menuItem = new TopMenuItem($menu); |
||
31 | $menuItem |
||
32 | ->setRoute('kunstmaanmenubundle_admin_menu') |
||
33 | ->setUniqueId('menus') |
||
34 | ->setLabel('kuma_menu.menus.title') |
||
35 | ->setParent($parent); |
||
36 | if ($request->attributes->get('_route') === 'kunstmaanmenubundle_admin_menu') { |
||
37 | $menuItem->setActive(true); |
||
38 | $parent->setActive(true); |
||
39 | } |
||
40 | $children[] = $menuItem; |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.