Conditions | 1 |
Paths | 1 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
16 | 21 | public function create(RoleInterface $role): bool |
|
17 | { |
||
18 | 21 | $created = $this->query()->create([ |
|
19 | 21 | 'name' => $role->getName(), |
|
20 | 21 | 'guard_name' => $role->getGuardName(), |
|
21 | ]); |
||
22 | |||
23 | 21 | $role->setId($created->id); |
|
24 | 21 | $role->setCreatedAt($created->created_at); |
|
25 | 21 | $role->setUpdatedAt($created->updated_at); |
|
26 | |||
27 | 21 | $this->syncPermissions($created, $role); |
|
28 | |||
29 | 21 | event(new RoleCreated($role, $created->wasRecentlyCreated)); |
|
30 | |||
31 | 21 | return $created->wasRecentlyCreated; |
|
32 | } |
||
33 | } |
||
34 |
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.