database/seeders/PermissionTableSeeder.php
Avoid using static access to class '\Spatie\Permission\Models\Permission' in method 'run'. Open
Open
Permission::findOrCreate($permission, 'api');
- Read upRead up
- Exclude checks
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
Open
$apiAdmin = Role::findOrCreate(UserRole::ADMIN, 'api');
- Read upRead up
- Exclude checks
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
Open
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
- Exclude checks
Call to method findOrCreate
from undeclared class \Spatie\Permission\Models\Role
Open
Open
$apiAdmin = Role::findOrCreate(UserRole::ADMIN, 'api');
- Exclude checks
Call to method findOrCreate
from undeclared class \Spatie\Permission\Models\Permission
Open
Open
Permission::findOrCreate($permission, 'api');
- Exclude checks
Class extends undeclared class \Illuminate\Database\Seeder
Open
Open
class PermissionTableSeeder extends Seeder
- Exclude checks
Reference to constant class
from undeclared class \Spatie\Permission\PermissionRegistrar
Open
Open
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
- Exclude checks
Reference to constant ADMIN
from undeclared class \EscolaLms\Core\Enums\UserRole
Open
Open
$apiAdmin = Role::findOrCreate(UserRole::ADMIN, 'api');
- Exclude checks
There must be one blank line after the last USE statement; 2 found; Open
Open
use Spatie\Permission\Models\Role;
- Exclude checks