EscolaLMS/Consultations

View on GitHub
database/migrations/2022_03_29_091847_add_new_permission_migrate.php

Summary

Maintainability
A
0 mins
Test Coverage

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

        Permission::findOrCreate(ConsultationsPermissionsEnum::CONSULTATION_CHANGE_TERM, '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\Permission' in method 'up'.
Open

        Permission::findOrCreate(ConsultationsPermissionsEnum::CONSULTATION_CHANGE_TERM, '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 method findOrCreate from undeclared class \Spatie\Permission\Models\Permission
Open

        Permission::findOrCreate(ConsultationsPermissionsEnum::CONSULTATION_CHANGE_TERM, 'api');

Class extends undeclared class \Illuminate\Database\Migrations\Migration
Open

class AddNewPermissionMigrate extends Migration

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

        Permission::findOrCreate(ConsultationsPermissionsEnum::CONSULTATION_CHANGE_TERM, 'api');

Avoid using short method names like AddNewPermissionMigrate::up(). The configured minimum method name length is 3.
Open

    public function up()
    {
        Permission::findOrCreate(ConsultationsPermissionsEnum::CONSULTATION_CHANGE_TERM, 'api');
    }

ShortMethodName

Since: 0.2

Detects when very short method names are used.

Example

class ShortMethod {
    public function a( $index ) { // Violation
    }
}

Source https://phpmd.org/rules/naming.html#shortmethodname

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class AddNewPermissionMigrate extends Migration

There are no issues that match your filters.

Category
Status