You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I am using a Trait to a Model class and fire up "Helper Code Generation", PhpStorm indicates that the Trait is used by the Model class referenced and by the helper model class which is kind of annoying.
Also, when the Trait has a relationship method defined, PhpStorm indicates that the method is overridden in the helper model class, which is misleading.
The Model A class:
<?php
namespace App\Models;
use App\Traits\SampleTrait;
use Illuminate\Database\Eloquent\Model;
class SampleModelA extends Model
{
use SampleTrait;
public $timestamps = false;
protected $fillable = [
'name',
];
}
The Model B class (used for the relation):
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SampleModelB extends Model
{
public $timestamps = false;
protected $fillable = [
'name',
];
}
The Trait class:
<?php
namespace App\Traits;
use App\Models\SampleModelB;
use Illuminate\Database\Eloquent\Relations\HasMany;
trait SampleTrait
{
public function sampleMethod(): string
{
return 'Sample method from SampleTrait';
}
public function sampleRelation(): HasMany
{
return $this->hasMany(SampleModelB::class);
}
}
How Trait looks in PhpStorm that is used by 2 class, the original and the duplicate helper class:
How Trait's relation method looks in PhpStorm that is falsely overridden in original class:
Plugin version
9.0.0.243
Operating system
Linux
Steps to reproduce
Create a model class SampleModelA
Create a model class SampleModelB
Create a Trait class SampleTrait and use it in the SampleModelA class
Add a HasMany relation method in SampleTrait from SampleModelA to SampleModelB
Fire up Helper Code Generation (Ctrl + Shift + .)
Relevant log output
No response
The text was updated successfully, but these errors were encountered:
Bug description
When I am using a Trait to a Model class and fire up "Helper Code Generation", PhpStorm indicates that the Trait is used by the Model class referenced and by the helper model class which is kind of annoying.
Also, when the Trait has a relationship method defined, PhpStorm indicates that the method is overridden in the helper model class, which is misleading.
The Model A class:
The Model B class (used for the relation):
The Trait class:
How Trait looks in PhpStorm that is used by 2 class, the original and the duplicate helper class:
How Trait's relation method looks in PhpStorm that is falsely overridden in original class:
Plugin version
9.0.0.243
Operating system
Linux
Steps to reproduce
Relevant log output
No response
The text was updated successfully, but these errors were encountered: