EscolaLMS/model-fields

View on GitHub
database/seeders/PermissionTableSeeder.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\Spatie\Permission\Models\Permission' in method 'run'.
Open

            Permission::findOrCreate($permission, 'api');

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Spatie\Permission\Models\Role' in method 'run'.
Open

        $apiAdmin = Role::findOrCreate(UserRole::ADMIN, 'api');

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Call to undeclared function \app()
Open

        app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
Severity: Critical
Found in database/seeders/PermissionTableSeeder.php by phan

Call to method findOrCreate from undeclared class \Spatie\Permission\Models\Role
Open

        $apiAdmin = Role::findOrCreate(UserRole::ADMIN, 'api');
Severity: Critical
Found in database/seeders/PermissionTableSeeder.php by phan

Call to method findOrCreate from undeclared class \Spatie\Permission\Models\Permission
Open

            Permission::findOrCreate($permission, 'api');
Severity: Critical
Found in database/seeders/PermissionTableSeeder.php by phan

Class extends undeclared class \Illuminate\Database\Seeder
Open

class PermissionTableSeeder extends Seeder
Severity: Critical
Found in database/seeders/PermissionTableSeeder.php by phan

Reference to constant class from undeclared class \Spatie\Permission\PermissionRegistrar
Open

        app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
Severity: Critical
Found in database/seeders/PermissionTableSeeder.php by phan

Reference to constant ADMIN from undeclared class \EscolaLms\Core\Enums\UserRole
Open

        $apiAdmin = Role::findOrCreate(UserRole::ADMIN, 'api');
Severity: Critical
Found in database/seeders/PermissionTableSeeder.php by phan

There must be one blank line after the last USE statement; 2 found;
Open

use Spatie\Permission\Models\Role;

There are no issues that match your filters.

Category
Status