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
{{ message }}
Repository navigation
Laravel: Method not found false positive (on Eloquent Model) #2420
I'm in a Laravel Model and phpactor is reporting that a method in the same class does not exist---however, the method clearly exists and jump-to-definition works so I'm not sure what's going on...
Reacted by Hind Sagar Biswas, Luke Arntz and Axel Rindle
After further inspection it looks to be a conflict with ide-helper helper file...apparently the helper file stub definition is replacing the real class definition instead of complimenting it
i'm not sure what you mean by that, there is a Eagle\...\WorkOrder stub? or your class extends a class which has a stub, or there is a mixin annotation?
One way the Laravel ide-helper works is by creating an _ide_helper_models.php file which contains stubs for all the models with auto-generated docblocks that look like the following:
The problem is that the stub and the class have the same name/namespace and so phpactor seems to replace its definition with the stub. Instead what should happen is the stub should compliment the class without replacing it. I tested intelephense and it prompts which definition you would like to jump to whereas phpactor jumps straight to the stub
I see, I guess perhaps Phpactor should allow multiple files to define classes and use the combination of any definitions... although that would be potentially quite a large undertaking (while "jumping to either file" is probably not very hard, squeezing both definitions into the same Reflection class could be an issue and relates to this problem)
Activity
dantleech commentedon Nov 6, 2023
What sort class is it? an enum perhaps? otherwise can you perhaps provide a failing test?
phpactor/lib/WorseReflection/Bridge/TolerantParser/Diagnostics/MissingMethodProvider.php
Line 151 in 2fa7ab2
calebdw commentedon Nov 6, 2023
After further inspection it looks to be a conflict with ide-helper helper file...apparently the helper file stub definition is replacing the real class definition instead of complimenting it
dantleech commentedon Nov 6, 2023
i'm not sure what you mean by that, there is a
Eagle\...\WorkOrderstub? or your class extends a class which has a stub, or there is a mixin annotation?calebdw commentedon Nov 9, 2023
@dantleech
One way the Laravel ide-helper works is by creating an
_ide_helper_models.phpfile which contains stubs for all the models with auto-generated docblocks that look like the following:The problem is that the stub and the class have the same name/namespace and so phpactor seems to replace its definition with the stub. Instead what should happen is the stub should compliment the class without replacing it. I tested intelephense and it prompts which definition you would like to jump to whereas phpactor jumps straight to the stub
[-]Method not found false positive[/-][+]Laravel: Method not found false positive (on Eloquent Model)[/+]dantleech commentedon Nov 9, 2023
I see, I guess perhaps Phpactor should allow multiple files to define classes and use the combination of any definitions... although that would be potentially quite a large undertaking (while "jumping to either file" is probably not very hard, squeezing both definitions into the same Reflection class could be an issue and relates to this problem)
dantleech commentedon Nov 23, 2023
hmm, also get this when including rector which has:
which prevents the real PHPUnit TestCase from being found.
hind-sagar-biswas commentedon Apr 7, 2024
I am facing similar issue.
caliguIa commentedon Apr 16, 2024
I am also facing this issue
khanakia commentedon Sep 4, 2024
Is there any solution yet ?
end3r-man commentedon Oct 25, 2024
any solution ??
calebdw commentedon Oct 25, 2024
Use:
end3r-man commentedon Oct 25, 2024
its working even having error, that Method where not found is show when
is enabled if is its false then their is no error also im unable to lsp for eloquent like where..., find...