-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DynamicCallOnStaticMethodsRule warns when both dynamic and static methods exist #140
Comments
What if? There's no Laravel-specific if in the codebase. Can you please describe the issue in more detail? Why is it reported and why is it a false positive? |
AFAIK the dynamic method is simply defined in the source code, the static method it added using Laravel macros which must be using What I know is both dynamic I'd like |
I'd like to ask @canvural to shine a little bit more technical light on this :) Thank you. |
@ondrejmirtes This is related to Laravel macros. This is the trait used in Laravel. As you can see it implements both In Larastan we have an extension for this macros, and it returns a For me the problem is because |
The following route: Route::get('/', function(\Illuminate\Contracts\Filesystem\Filesystem $factory) { return $factory->download('foo.csv'); }); currently results in the following false-positive error: ------ ------------------------------------------------------------------------------------ Line routes/web.php ------ ------------------------------------------------------------------------------------ 22 Dynamic call to static method Illuminate\Filesystem\FilesystemAdapter::download(). ------ ------------------------------------------------------------------------------------ See phpstan/phpstan-strict-rules#140
The following route: Route::get('/', function(\Illuminate\Contracts\Filesystem\Filesystem $factory) { return $factory->download('foo.csv'); }); currently results in the following false-positive error: ------ ------------------------------------------------------------------------------------ Line routes/web.php ------ ------------------------------------------------------------------------------------ 22 Dynamic call to static method Illuminate\Filesystem\FilesystemAdapter::download(). ------ ------------------------------------------------------------------------------------ See phpstan/phpstan-strict-rules#140 See larastan/larastan#1272
I am not sure if I grasp the problem completely as I am not that deep into the whole PHPStan inner workings. But just for clarification It is currently IMPOSSIBLE to determine (in Larastan?) what is a macro call? and what is not, correct?
What would you need to determine the difference? My understanding of the situation so far: As I experience this problem with the The Doesn't the error message Again, I am not sure if I grasp the all the circumstances here. I am new to the whole Laravel world and their incredible complicated and inconsistent way of handling things xD (no hate,.... okay, little hate xD). I am still figuring out what the best way to handle everyday situations like these is. So, please, educate me. |
In Laravel we have
Request->validate()
andRequest::validate()
too.DynamicCallOnStaticMethodsRule
emit an error when it seesRequest->validate()
.Could you add one more
if
-s?The text was updated successfully, but these errors were encountered: