database/factories/ConsultationFactory.php
Avoid using static access to class '\EscolaLms\Consultations\Enum\ConsultationStatusEnum' in method 'definition'. Open
Open
'status' => $this->faker->randomElement(ConsultationStatusEnum::getValues()),
- 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
Static call to undeclared method \EscolaLms\Consultations\Enum\ConsultationStatusEnum::getValues
Open
Open
'status' => $this->faker->randomElement(ConsultationStatusEnum::getValues()),
- Exclude checks
Call to undeclared function \now()
Open
Open
$now = now();
- Exclude checks
Reference to undeclared property \EscolaLms\Consultations\Database\Factories\ConsultationFactory->faker
Open
Open
'description' => $this->faker->sentence,
- Exclude checks
Call to method role
from undeclared class \EscolaLms\Auth\Models\User
(Did you mean class \EscolaLms\Consultations\Models\User) Open
Open
$tutor = User::role(UserRole::TUTOR)->inRandomOrder()->first();
- Exclude checks
Class extends undeclared class \Illuminate\Database\Eloquent\Factories\Factory
Open
Open
class ConsultationFactory extends Factory
- Exclude checks
Reference to undeclared property \EscolaLms\Consultations\Database\Factories\ConsultationFactory->faker
Open
Open
'status' => $this->faker->randomElement(ConsultationStatusEnum::getValues()),
- Exclude checks
Reference to undeclared property \EscolaLms\Consultations\Database\Factories\ConsultationFactory->faker
Open
Open
'name' => $this->faker->sentence(10),
- Exclude checks
Reference to constant TUTOR
from undeclared class \EscolaLms\Core\Enums\UserRole
Open
Open
$tutor = User::role(UserRole::TUTOR)->inRandomOrder()->first();
- Exclude checks
Reference to undeclared property \EscolaLms\Consultations\Database\Factories\ConsultationFactory->faker
Open
Open
'short_desc' => $this->faker->sentence,
- Exclude checks