IDE can't find method while it's in the very same file. The highlighting really bothers me. How do I "trick" it? Any phpdoc syntax to force the IDE to understand it has to find it right below?
Well .. you are calling validateCascadingSoftDelete on a $model parameter .. but not stating what type that parameter is (anywhere). So yes -- that's expected behaviour here.
If that is a method from the same trait .. then $model can be typehinted with $this type (or use trait's name instead) .. so try this first: place the following before first usage of $model:
Yes, by typehint here I meant the PHPDoc comment and not a native PHP parameter typehint (as I do understand how such kind of trait may be used with Models (some models can have it, some do not etc)).
I had a suspicion that $this may not work in such place hence the suggestion to try a trait's name instead.
Hi there,
Well .. you are calling validateCascadingSoftDelete on a $model parameter .. but not stating what type that parameter is (anywhere). So yes -- that's expected behaviour here.
If that is a method from the same trait .. then $model can be typehinted with $this type (or use trait's name instead) .. so try this first: place the following before first usage of $model:
I can't typehint. I'd need to implement an interface.
That did the trick for PhpStorm though. Cheers!
```php
/** @var CascadeSoftDeletes $model */```
Yes, by typehint here I meant the PHPDoc comment and not a native PHP parameter typehint (as I do understand how such kind of trait may be used with Models (some models can have it, some do not etc)).
I had a suspicion that $this may not work in such place hence the suggestion to try a trait's name instead.
Glad that inline PHPDoc worked.