| Conditions | 1 |
| Paths | 1 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 19 | public function create(UserInterface $user): bool |
|
| 17 | { |
||
| 18 | 19 | $created = $this->query()->create([ |
|
| 19 | 19 | 'name' => $user->getName(), |
|
| 20 | 19 | 'language' => $user->getLanguage(), |
|
| 21 | 19 | 'email' => $user->getEmail(), |
|
| 22 | 19 | 'email_verified_at' => $user->getEmailVerifiedAt(), |
|
| 23 | 19 | 'password' => $user->getPassword(), |
|
| 24 | 19 | 'remember_token' => $user->getRememberToken(), |
|
| 25 | ]); |
||
| 26 | |||
| 27 | 19 | $user->setId($created->id); |
|
| 28 | 19 | $user->setCreatedAt($created->created_at); |
|
| 29 | 19 | $user->setUpdatedAt($created->updated_at); |
|
| 30 | |||
| 31 | 19 | $this->syncPermissions($created, $user); |
|
| 32 | 19 | $this->syncRoles($created, $user); |
|
| 33 | |||
| 34 | 19 | event(new UserCreated($user, $created->wasRecentlyCreated)); |
|
| 35 | |||
| 36 | 19 | return $created->wasRecentlyCreated; |
|
| 37 | } |
||
| 38 | } |
||
| 39 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.