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 — add-update-command ( 44cb20 )
by Cristian
14:39
created

EnsureLaravelVersionStep::run()   A

Complexity

Conditions 5
Paths 4

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
eloc 11
c 2
b 1
f 1
nc 4
nop 0
dl 0
loc 19
cc 5
rs 9.6111
1
<?php
2
3
namespace Backpack\CRUD\app\Console\Commands\Upgrade\v7\Steps;
4
5
use Backpack\CRUD\app\Console\Commands\Upgrade\Step;
6
use Backpack\CRUD\app\Console\Commands\Upgrade\StepResult;
7
8
class EnsureLaravelVersionStep extends Step
9
{
10
    public function title(): string
11
    {
12
        return 'Check if Laravel version 12 or higher is installed';
13
    }
14
15
    public function run(): StepResult
16
    {
17
        $prettyVersion = $this->context()->installedPackagePrettyVersion('laravel/framework') ?? app()->version();
0 ignored issues
show
introduced by
The method version() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        $prettyVersion = $this->context()->installedPackagePrettyVersion('laravel/framework') ?? app()->/** @scrutinizer ignore-call */ version();
Loading history...
18
        $major = $this->context()->packageMajorVersion('laravel/framework');
19
20
        if ($major === null && preg_match('/(\d+)/', $prettyVersion, $matches)) {
21
            $major = (int) $matches[1];
22
        }
23
24
        if ($major !== null && $major >= 12) {
25
            return StepResult::success("Detected Laravel {$prettyVersion}.");
26
        }
27
28
        return StepResult::failure(
29
            'Upgrade to Laravel 12 before running the Backpack v7 upgrade.',
30
            [
31
                "Detected Laravel version: {$prettyVersion}",
32
                'Follow the official upgrade guide: https://laravel.com/docs/12.x/upgrade',
33
                'After upgrading to Laravel 12, test everything is working in your app and admin panel.',
34
            ]
35
        );
36
    }
37
38
    public function isBlocking(): bool
39
    {
40
        return true;
41
    }
42
}
43