We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Total Complexity | 10 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class MultipleAttribute extends BaseAttribute implements AttributeInterface |
||
9 | { |
||
10 | public static function getDefault(AttributeCollection $attributes) |
||
11 | { |
||
12 | switch ($attributes->getAttributeValue('relation_type')) { |
||
13 | case 'BelongsToMany': |
||
14 | case 'HasMany': |
||
15 | case 'HasManyThrough': |
||
16 | case 'HasOneOrMany': |
||
17 | case 'MorphMany': |
||
18 | case 'MorphOneOrMany': |
||
19 | case 'MorphToMany': |
||
20 | return true; |
||
21 | default: |
||
22 | return false; |
||
23 | } |
||
24 | |||
25 | return false; |
||
|
|||
26 | } |
||
27 | |||
28 | public static function getValidationRules(): array |
||
29 | { |
||
30 | return ['nullable|string']; |
||
31 | } |
||
32 | |||
33 | public static function getAttributeName(): string |
||
36 | } |
||
37 | } |
||
38 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.