| Total Complexity | 10 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | trait StandaloneLaruploadCover |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @internal |
||
| 11 | */ |
||
| 12 | public function updateCover(UploadedFile $file): bool |
||
| 13 | { |
||
| 14 | if ($this->internalFunctionIsCallable) { |
||
| 15 | return parent::updateCover($file); |
||
| 16 | } |
||
| 17 | |||
| 18 | $this->internalException(); |
||
| 19 | } |
||
| 20 | |||
| 21 | public function changeCover(UploadedFile $file): ?object |
||
| 22 | { |
||
| 23 | if ($this->metaExists()) { |
||
| 24 | $this->internalFunctionIsCallable = true; |
||
| 25 | $res = $this->updateCover($file); |
||
| 26 | |||
| 27 | if ($res) { |
||
| 28 | $this->setCover($this->id); |
||
| 29 | $this->updateMeta(); |
||
| 30 | |||
| 31 | return $this->urls(); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | return null; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function deleteCover(): ?object |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @internal |
||
| 57 | */ |
||
| 58 | public function detachCover(): bool |
||
| 65 | } |
||
| 66 | } |
||
| 67 |
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: