EscolaLMS/model-fields

View on GitHub
database/migrations/2022_02_25_015410_create_model_fields_metadata_table.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\Illuminate\Support\Facades\Schema' in method 'down'.
Open

        Schema::drop('model_fields_metadata');

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 '\Illuminate\Support\Facades\Schema' in method 'up'.
Open

        Schema::create('model_fields_metadata', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();
            $table->string('name', 255)->index();
            $table->enum('type', ['boolean', 'number', 'varchar', 'text', 'json'])->default('varchar'); // this must be compatible with EscolaLms\ModelFields\Enum\MetaFieldTypeEnum::getValues()

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

Parameter $table has undeclared type \Illuminate\Database\Schema\Blueprint
Open

        Schema::create('model_fields_metadata', function (Blueprint $table) {

Call to method drop from undeclared class \Illuminate\Support\Facades\Schema
Open

        Schema::drop('model_fields_metadata');

Call to method integer from undeclared class \Illuminate\Database\Schema\Blueprint
Open

            $table->integer('visibility')->default(1 << 0);

Call to method bigIncrements from undeclared class \Illuminate\Database\Schema\Blueprint
Open

            $table->bigIncrements('id');

Call to method enum from undeclared class \Illuminate\Database\Schema\Blueprint
Open

            $table->enum('type', ['boolean', 'number', 'varchar', 'text', 'json'])->default('varchar'); // this must be compatible with EscolaLms\ModelFields\Enum\MetaFieldTypeEnum::getValues()

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

class CreateModelFieldsMetadataTable extends Migration

Call to method create from undeclared class \Illuminate\Support\Facades\Schema
Open

        Schema::create('model_fields_metadata', function (Blueprint $table) {

Call to method json from undeclared class \Illuminate\Database\Schema\Blueprint
Open

            $table->json('rules')->nullable();

Call to method json from undeclared class \Illuminate\Database\Schema\Blueprint
Open

            $table->json('extra')->nullable();

Call to method text from undeclared class \Illuminate\Database\Schema\Blueprint
Open

            $table->text('default')->nullable();

Call to method string from undeclared class \Illuminate\Database\Schema\Blueprint
Open

            $table->string('class_type', 255)->index();

Call to method timestamps from undeclared class \Illuminate\Database\Schema\Blueprint
Open

            $table->timestamps();

Call to method string from undeclared class \Illuminate\Database\Schema\Blueprint
Open

            $table->string('name', 255)->index();

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

    public function up()
    {
        Schema::create('model_fields_metadata', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();

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 CreateModelFieldsMetadataTable extends Migration

There are no issues that match your filters.

Category
Status