-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix "php_unit_test_case_static_method_calls" CS #9314
Fix "php_unit_test_case_static_method_calls" CS #9314
Conversation
de267b5
to
394095d
Compare
I generally don't like this idea. Whenever I have an object instance I prefer to use it instead of a static call. E.g.
looks better than
Maybe if a class has static methods only... So, probably TestCase is such a case, but everything inheriting from it should be using static methods (and properties) only too. |
I would say you are used to that, but it is definitely less readable, as one call needs an instance, the other not. With Let's land this for the PHPUnit static methods. It will be checked by CI, thus we can be sure only one coding style will be used. |
394095d
to
1842939
Compare
c4c0e30
to
646c04f
Compare
6ab08da
to
4196bd8
Compare
189937a
to
514622d
Compare
PR is done and it fixes most of the |
514622d
to
e5f5a35
Compare
@alecpl can this PR be merged? |
I don't like it. And I don't want any "risky" rules. Sorry. |
originally discussed in #9303 (comment)
This is non-functional change only, but I belive calling
TestCase::assertXxx
static methods as non-static like$this->assertXxx()
should be replaced withself::assertXxx()
because static methods should be simply called statically.Later, we should require this using PHPStan across the whole project, for now, let's require this using PHP CS Fixer for (known) TestCase methods only.