| Conditions | 6 |
| Paths | 8 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function __construct($errors) |
||
| 30 | { |
||
| 31 | if ($errors instanceof ErrorCollection) { |
||
| 32 | $this->errors = $errors; |
||
|
|
|||
| 33 | } elseif (is_array($errors) || $errors instanceof Collection) { |
||
| 34 | $this->errors = new ErrorCollection($errors); |
||
| 35 | } elseif ($errors instanceof Error) { |
||
| 36 | $this->errors = (new ErrorCollection)->push($errors); |
||
| 37 | $this->errors->setStatusCode($errors->getStatus()); |
||
| 38 | } |
||
| 39 | |||
| 40 | if (! $this->errors instanceof ErrorCollection) { |
||
| 41 | throw new InvalidArgumentException('The errors must be an array, '.Collection::class.','.Error::class.' or '.ErrorCollection::class.'.'); |
||
| 42 | } |
||
| 43 | |||
| 44 | $this->errors->validate(); |
||
| 45 | |||
| 46 | $this->setStatus($this->errors->getStatusCode()); |
||
| 47 | } |
||
| 97 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..