staudenmeir / eloquent-has-many-deep

Laravel Eloquent HasManyThrough relationships with unlimited levels

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHPStorm warns about trait collision with "ConcatenatesRelationships"

roberttolton opened this issue · comments

Hi, many thanks for this package.

Recently, PHPStorm has been warning me, with models that were once previously clear of warnings, of the following:

Trait method 'hasOneOrManyDeepFromBelongsTo' will not be applied because it collides with 'ConcatenatesRelationships'
Trait method 'hasOneOrManyDeepFromBelongsToMany' will not be applied because it collides with 'ConcatenatesRelationships'
Trait method 'hasOneOrManyDeepFromHasManyThrough' will not be applied because it collides with 'ConcatenatesRelationships'
Trait method 'hasOneOrManyDeepFromHasOneOrMany' will not be applied because it collides with 'ConcatenatesRelationships'
Trait method 'hasOneOrManyDeepFromMorphOneOrMany' will not be applied because it collides with 'ConcatenatesRelationships'
Trait method 'hasOneOrManyDeepFromMorphToMany' will not be applied because it collides with 'ConcatenatesRelationships'
Trait method 'hasOneOrManyDeepRelationMethod' will not be applied because it collides with 'ConcatenatesRelationships'

My model just uses HasRelationships.

Is this anything to worry about?

Hi @roberttolton,
In which model/trait are hasOneOrManyDeepFromBelongsTo() etc. located?

@staudenmeir Just a regular model within my \App\Models directory, and I'm only actually using a hasOneDeep relation in that particular model.

Can you share a screenshot of the warning(s)? Is it shown on the line use HasRelationships;?

image
here you go, i just ran into this upgrading to laravel 10 and php82 @staudenmeir

What version of the package are you using?

I am using 1.18 and language level on phpstorm i have tried 8.0 and 8.1

Really weird. These methods only exist in the ConcatenatesRelationships trait so the warnings don't make sense. Looks like an issue with the PhpStorm cache.

@chrisworrell Thanks for the screenshot - that's what I'm seeing as well.

Screenshot 2023-05-16 at 22 41 57

I tried clearing the full cache in phpstorm but i am still getting the error, strange because another person i know that uses the same version and php 8.1 is not getting it 🤷

yea i dont think its related to this package i just ran into the following with laravel cashier

image

@roberttolton are you using vapor? i noticed my local system had a new .vapor that essentially duplicated the entire package structure of what my laravel system had, i removed that and the errors are gone, im betting you have some sort of duplication like i had and phpstorm is picking up on it @staudenmeir sorry to bother you, thank you so much for the package let me know how i can buy you a beer /cheers

@chrisworrell I'm not using Vapor, and I don't have any .vapor folder in my project. I can't find any duplication, but I did have a custom Laravel package added to the Project window in PHPStorm, and detaching that seems to have sorted it..? So indeed, sorry for the bother @staudenmeir