| Conditions | 1 |
| Paths | 1 |
| Total Lines | 19 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.
There are several approaches to avoid long parameter lists:
| 1 | <?php |
||
| 28 | public function __construct( |
||
| 29 | string $id, |
||
| 30 | string $email, |
||
| 31 | string $username, |
||
| 32 | string $firsName, |
||
| 33 | string $lastName, |
||
| 34 | $imageName, |
||
| 35 | $imageMimeType, |
||
| 36 | $uploadedImage |
||
| 37 | ) { |
||
| 38 | $this->id = $id; |
||
| 39 | $this->email = $email; |
||
| 40 | $this->username = $username; |
||
| 41 | $this->firstName = $firsName; |
||
| 42 | $this->lastName = $lastName; |
||
| 43 | $this->imageName = $imageName; |
||
| 44 | $this->imageMimeType = $imageMimeType; |
||
| 45 | $this->uploadedImage = $uploadedImage; |
||
| 46 | } |
||
| 47 | |||
| 88 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@returnannotation as described here.