1 | <?php |
||
16 | trait ParameterTrait |
||
17 | { |
||
18 | /** |
||
19 | * Parameter alias key map. |
||
20 | * |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $parameterAliasMap = []; |
||
24 | |||
25 | /** |
||
26 | * List of parameters. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $parameters = []; |
||
31 | |||
32 | /** |
||
33 | * Get parameters. |
||
34 | * |
||
35 | * @return array |
||
36 | */ |
||
37 | public function getParameters() |
||
41 | |||
42 | /** |
||
43 | * Set parameters. |
||
44 | * |
||
45 | * @param array $parameters |
||
46 | * |
||
47 | * @return $this |
||
48 | */ |
||
49 | public function setParameters($parameters) |
||
59 | |||
60 | /** |
||
61 | * Has parameter. |
||
62 | * |
||
63 | * @param string $parameter |
||
64 | * |
||
65 | * @return bool |
||
66 | */ |
||
67 | public function hasParameter($parameter) |
||
71 | |||
72 | /** |
||
73 | * Easy access to parameters. |
||
74 | * |
||
75 | * @param string $name |
||
76 | * @param array $arguments |
||
|
|||
77 | * |
||
78 | * @return mixed |
||
79 | */ |
||
80 | public function __call($name, array $arguments = null) |
||
88 | |||
89 | /** |
||
90 | * Get parameter. |
||
91 | * |
||
92 | * @param string $parameter |
||
93 | * @param mixed $default |
||
94 | * |
||
95 | * @return mixed |
||
96 | */ |
||
97 | public function getParameter($parameter, $default = null) |
||
103 | |||
104 | /** |
||
105 | * Set parameter. |
||
106 | * |
||
107 | * @param string $parameter |
||
108 | * @param mixed $value |
||
109 | * |
||
110 | * @return $this |
||
111 | */ |
||
112 | public function setParameter($parameter, $value) |
||
118 | |||
119 | /** |
||
120 | * Get normalized service parameter. |
||
121 | * |
||
122 | * @param string $parameter |
||
123 | * |
||
124 | * @return string |
||
125 | */ |
||
126 | protected function getMappedParameter($parameter) |
||
136 | } |
||
137 |
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. In addition it looks for parameters that have the generic type
array
and suggests a stricter type likearray<String>
.Most often this is a case of a parameter that can be null in addition to its declared types.