1 | <?php |
||
31 | class PhpParameter extends AbstractModel { |
||
32 | |||
33 | use NameTrait; |
||
34 | use DefaultValueTrait; |
||
35 | use TypeTrait; |
||
36 | |||
37 | private $passedByReference = false; |
||
38 | |||
39 | /** |
||
40 | * Creates a new PHP parameter. |
||
41 | * |
||
42 | * @param string $name the parameter name |
||
43 | * @return static |
||
44 | */ |
||
45 | 15 | public static function create($name = null) { |
|
48 | |||
49 | /** |
||
50 | * Creates a PHP parameter from reflection |
||
51 | * |
||
52 | * @param \ReflectionParameter $ref |
||
53 | * @return PhpParameter |
||
54 | */ |
||
55 | 4 | public static function fromReflection(\ReflectionParameter $ref) { |
|
88 | |||
89 | /** |
||
90 | * Creates a new PHP parameter |
||
91 | * |
||
92 | * @param string $name the parameter name |
||
93 | */ |
||
94 | 25 | public function __construct($name = null) { |
|
97 | |||
98 | /** |
||
99 | * Sets whether this parameter is passed by reference |
||
100 | * |
||
101 | * @param boolean $bool `true` if passed by reference and `false` if not |
||
102 | * @return $this |
||
103 | */ |
||
104 | 5 | public function setPassedByReference($bool) { |
|
109 | |||
110 | /** |
||
111 | * Returns whether this parameter is passed by reference |
||
112 | * |
||
113 | * @return boolean `true` if passed by reference and `false` if not |
||
114 | */ |
||
115 | 11 | public function isPassedByReference() { |
|
118 | |||
119 | /** |
||
120 | * Returns a docblock tag for this parameter |
||
121 | * |
||
122 | * @return ParamTag |
||
123 | */ |
||
124 | 7 | public function getDocblockTag() { |
|
130 | |||
131 | /** |
||
132 | * Alias for setDescription() |
||
133 | * |
||
134 | * @see #setDescription |
||
135 | * @param string $description |
||
136 | * @return $this |
||
137 | */ |
||
138 | 7 | public function setTypeDescription($description) { |
|
141 | |||
142 | /** |
||
143 | * Alias for getDescription() |
||
144 | * |
||
145 | * @see #getDescription |
||
146 | * @return string |
||
147 | */ |
||
148 | 8 | public function getTypeDescription() { |
|
151 | } |
||
152 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.