laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.38k stars 10.98k forks source link

Non-static method 'middleware' should not be called statically #25118

Closed tianmingxing closed 6 years ago

tianmingxing commented 6 years ago

Description:

I am writing code using IDE (phpstorm), I get a hint in several files "Non-static method 'middleware' should not be called statically", why should I tolerate this error, although the program is runnable?

The use of this kind of error makes me feel awkward. What is the purpose of this design? Is it possible to allow this encoding in the new version of PHP?

Non-static method 'middleware' should not be called statically less... (Ctrl+F1) 
Inspection info: Dynamic class method called as static.
tillkruss commented 6 years ago

That sounds like PHPMD complaining.

tianmingxing commented 6 years ago

@tillkruss Maybe you can give me an explanation, I will thank you very much!

tillkruss commented 6 years ago

https://phpmd.org/rules/cleancode.html#staticaccess

tianmingxing commented 6 years ago

@tillkruss I want to know if the PHP syntax specification is recommended for this encoding method? Even if you can write code like this, is there really no problem?