src/Models/ConsultationUserPivot.php
Avoid using static access to class '\EscolaLms\Consultations\Database\Factories\ConsultationUserFactory' in method 'newFactory'. Open
Open
return ConsultationUserFactory::new();
- 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
Return type of user()
is undeclared type \Illuminate\Database\Eloquent\Relations\BelongsTo
Open
Open
public function user(): BelongsTo
- Exclude checks
Class extends undeclared class \Illuminate\Database\Eloquent\Model
Open
Open
class ConsultationUserPivot extends Model
- Exclude checks
Call to undeclared method \EscolaLms\Consultations\Enum\ConsultationTermStatusEnum::is
Open
Open
return $this->executed_status->is(ConsultationTermStatusEnum::REJECT);
- Exclude checks
Return type of consultation()
is undeclared type \Illuminate\Database\Eloquent\Relations\BelongsTo
Open
Open
public function consultation(): BelongsTo
- Exclude checks
Call to undeclared method \EscolaLms\Consultations\Enum\ConsultationTermStatusEnum::is
Open
Open
return $this->executed_status->is(ConsultationTermStatusEnum::APPROVED);
- Exclude checks
Call to undeclared method \EscolaLms\Consultations\Models\ConsultationUserPivot::belongsTo
Open
Open
return $this->belongsTo(User::class, 'user_id', 'id', 'users');
- Exclude checks
Class uses undeclared trait \Illuminate\Database\Eloquent\Factories\HasFactory
Open
Open
class ConsultationUserPivot extends Model
- Exclude checks
Call to undeclared method \EscolaLms\Consultations\Models\ConsultationUserPivot::belongsTo
Open
Open
return $this->belongsTo(Consultation::class);
- Exclude checks
Call to undeclared method \EscolaLms\Consultations\Models\ConsultationUserPivot::hasMany
Open
Open
return $this->hasMany(ConsultationUserTerm::class, 'consultation_user_id');
- Exclude checks
Static call to undeclared method \EscolaLms\Consultations\Database\Factories\ConsultationUserFactory::new
Open
Open
return ConsultationUserFactory::new();
- Exclude checks
Property \EscolaLms\Consultations\Models\ConsultationUserPivot->executed_at
has undeclared type \Illuminate\Support\Carbon
Open
Open
* @property Carbon $executed_at
- Exclude checks
Return type of userTerms()
is undeclared type \Illuminate\Database\Eloquent\Relations\HasMany
Open
Open
public function userTerms(): HasMany
- Exclude checks