Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Push — poc-backpack-components ( 0ddd2c...dbc69d )
by Pedro
26:57
created

Multiple::getValidationRules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Backpack\CRUD\app\Library\Components\Attributes;
4
5
use Backpack\CRUD\app\Library\Components\AttributeCollection;
0 ignored issues
show
Bug introduced by
The type Backpack\CRUD\app\Librar...nts\AttributeCollection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Backpack\CRUD\app\Library\Components\Interfaces\SmartAttributeInterface;
7
use Backpack\CRUD\app\Library\Components\Interfaces\SmartCollectionInterface;
8
9
class Multiple extends BaseAttribute implements SmartAttributeInterface
10
{
11
    public static function getDefault(SmartCollectionInterface $attributes)
12
    {
13
        switch ($attributes->getAttributeValue('relation_type')) {
14
            case 'BelongsToMany':
15
            case 'HasMany':
16
            case 'HasManyThrough':
17
            case 'HasOneOrMany':
18
            case 'MorphMany':
19
            case 'MorphOneOrMany':
20
            case 'MorphToMany':
21
                return true;
22
            default:
23
                return false;
24
        }
25
26
        return false;
0 ignored issues
show
Unused Code introduced by
return false is not reachable.

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 or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

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.

Loading history...
27
    }
28
29
    public static function getValidationRules(SmartCollectionInterface $attributes): array
30
    {
31
        return ['nullable','string'];
32
    }
33
34
    public static function getAttributeName(): string
35
    {
36
        return 'relation_type';
37
    }
38
}
39