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

Issues (990)

Branch: next

tests/config/CrudPanel/BaseCrudPanel.php (1 issue)

1
<?php
2
3
namespace Backpack\CRUD\Tests\Config\CrudPanel;
4
5
use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
6
use Backpack\CRUD\Tests\BaseTestClass;
7
use Backpack\CRUD\Tests\config\Models\TestModel;
8
9
abstract class BaseCrudPanel extends BaseTestClass
10
{
11
    /**
12
     * @var CrudPanel
13
     */
14
    protected $crudPanel;
15
16
    protected $model;
17
18
    /**
19
     * Setup the test environment.
20
     *
21
     * @return void
22
     */
23
    protected function setUp(): void
24
    {
25
        parent::setUp();
26
27
        $this->crudPanel = app('crud');
0 ignored issues
show
Documentation Bug introduced by
It seems like app('crud') can also be of type Illuminate\Contracts\Foundation\Application or Illuminate\Foundation\Application. However, the property $crudPanel is declared as type Backpack\CRUD\app\Library\CrudPanel\CrudPanel. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
28
        $this->crudPanel->setModel(TestModel::class);
29
        $this->crudPanel->setRequest();
30
        $this->model = TestModel::class;
31
    }
32
33
    /**
34
     * Define environment setup.
35
     *
36
     * @param  \Illuminate\Foundation\Application  $app
37
     * @return void
38
     */
39
    protected function getEnvironmentSetUp($app)
40
    {
41
        $app['config']->set('database.default', 'testing');
42
        $app['config']->set('backpack.base.route_prefix', 'admin');
43
44
        $app->bind('App\Http\Middleware\CheckIfAdmin', function () {
45
            return new class
46
            {
47
                public function handle($request, $next)
48
                {
49
                    return $next($request);
50
                }
51
            };
52
        });
53
54
        $app->scoped('crud', function () {
55
            return new CrudPanel();
56
        });
57
    }
58
}
59