database/migrations/2022_02_07_142406_remove_missing_columns.php
Avoid using static access to class '\Illuminate\Support\Facades\Schema' in method 'down'. Open
Open
Schema::table('consultations', function (Blueprint $table) {
$table->text('calendar_url')->nullable();
});
- 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 '\Illuminate\Support\Facades\Schema' in method 'up'. Open
Open
Schema::table('consultations', function (Blueprint $table) {
$table->dropColumn('calendar_url');
});
- 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 method table
from undeclared class \Illuminate\Support\Facades\Schema
Open
Open
Schema::table('consultations', function (Blueprint $table) {
- Exclude checks
Call to method text
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->text('calendar_url')->nullable();
- Exclude checks
Parameter $table
has undeclared type \Illuminate\Database\Schema\Blueprint
Open
Open
Schema::table('consultations', function (Blueprint $table) {
- Exclude checks
Call to method dropColumn
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->dropColumn('calendar_url');
- Exclude checks
Class extends undeclared class \Illuminate\Database\Migrations\Migration
Open
Open
class RemoveMissingColumns extends Migration
- Exclude checks
Call to method table
from undeclared class \Illuminate\Support\Facades\Schema
Open
Open
Schema::table('consultations', function (Blueprint $table) {
- Exclude checks
Parameter $table
has undeclared type \Illuminate\Database\Schema\Blueprint
Open
Open
Schema::table('consultations', function (Blueprint $table) {
- Exclude checks
Avoid using short method names like RemoveMissingColumns::up(). The configured minimum method name length is 3. Open
Open
public function up(): void
{
Schema::table('consultations', function (Blueprint $table) {
$table->dropColumn('calendar_url');
});
- Read upRead up
- Exclude checks
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
Open
class RemoveMissingColumns extends Migration
- Exclude checks