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\AdminListBundle\AdminList\ItemAction; |
||
4 | |||
5 | /** |
||
6 | * The simple item action is a default implementation of the item action interface, this can be used |
||
7 | * in very simple use cases. |
||
8 | */ |
||
9 | class SimpleItemAction implements ItemActionInterface |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * @var callable |
||
14 | */ |
||
15 | private $routerGenerator; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $icon; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $label; |
||
26 | |||
27 | /** |
||
28 | * @var null|string |
||
29 | */ |
||
30 | private $template; |
||
31 | |||
32 | /** |
||
33 | * @param callable $routerGenerator The generator used to generate the url of an item, when generating the item will |
||
34 | * be provided. |
||
35 | * @param string $icon The icon |
||
36 | * @param string $label The label |
||
37 | * @param string $template The template |
||
0 ignored issues
–
show
|
|||
38 | */ |
||
39 | public function __construct($routerGenerator, $icon, $label, $template = null) |
||
40 | { |
||
41 | $this->routerGenerator = $routerGenerator; |
||
42 | $this->icon = $icon; |
||
43 | $this->label = $label; |
||
44 | $this->template = $template; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param mixed $item |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | public function getUrlFor($item) |
||
53 | { |
||
54 | $routeGenerator = $this->routerGenerator; |
||
55 | if (is_callable($routeGenerator)) { |
||
56 | return $routeGenerator($item); |
||
57 | } |
||
58 | |||
59 | return null; |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @param mixed $item |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | public function getIconFor($item) |
||
68 | { |
||
69 | return $this->icon; |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @param mixed $item |
||
74 | * |
||
75 | * @return string |
||
76 | */ |
||
77 | public function getLabelFor($item) |
||
78 | { |
||
79 | return $this->label; |
||
80 | } |
||
81 | |||
82 | /** |
||
83 | * @return string |
||
84 | */ |
||
85 | public function getTemplate() |
||
86 | { |
||
87 | return $this->template; |
||
88 | } |
||
89 | |||
90 | } |
||
91 |
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.