database/migrations/2022_02_15_141832_create_webinars_table.php
Avoid using static access to class '\Illuminate\Support\Facades\Schema' in method 'up'. Open
Open
Schema::create('webinars', function (Blueprint $table) {
$table->id();
$table->bigInteger('author_id')->unsigned()->nullable();
$table->integer('base_price')->nullable();
$table->string('name', 255);
- 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 'down'. Open
Open
Schema::dropIfExists('webinars');
- 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
Parameter $table
has undeclared type \Illuminate\Database\Schema\Blueprint
Open
Open
Schema::create('webinars', function (Blueprint $table) {
- Exclude checks
Call to method integer
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->integer('base_price')->nullable();
- Exclude checks
Call to method foreign
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->foreign('author_id')->references('id')->on('users')->onDelete('SET NULL');
- Exclude checks
Call to method string
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->string('name', 255);
- Exclude checks
Call to method create
from undeclared class \Illuminate\Support\Facades\Schema
Open
Open
Schema::create('webinars', function (Blueprint $table) {
- Exclude checks
Call to method id
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->id();
- Exclude checks
Call to method text
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->text('description');
- Exclude checks
Call to method dateTime
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->dateTime('active_to')->nullable();
- Exclude checks
Call to method dropIfExists
from undeclared class \Illuminate\Support\Facades\Schema
Open
Open
Schema::dropIfExists('webinars');
- Exclude checks
Class extends undeclared class \Illuminate\Database\Migrations\Migration
Open
Open
class CreateWebinarsTable extends Migration
- Exclude checks
Call to method dateTime
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->dateTime('active_from')->nullable();
- Exclude checks
Call to method string
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->string('duration')->nullable();
- Exclude checks
Call to method bigInteger
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->bigInteger('author_id')->unsigned()->nullable();
- Exclude checks
Call to method string
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->string('status')->default(WebinarStatusEnum::DRAFT);
- Exclude checks
Call to method timestamps
from undeclared class \Illuminate\Database\Schema\Blueprint
Open
Open
$table->timestamps();
- Exclude checks
Avoid using short method names like CreateWebinarsTable::up(). The configured minimum method name length is 3. Open
Open
public function up(): void
{
Schema::create('webinars', function (Blueprint $table) {
$table->id();
$table->bigInteger('author_id')->unsigned()->nullable();
- 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 CreateWebinarsTable extends Migration
- Exclude checks