Php-cs-fixer: Contradiction between PHPUnit rules when they are used with defaults

Created on 21 Sep 2018  路  4Comments  路  Source: FriendsOfPHP/PHP-CS-Fixer

There is a contradiction between php_unit_internal_class, final_internal_class, and php_unit_test_case_static_method_calls rules when they are used together with default options.

  1. php_unit_internal_class marks PHPUnit test classes as internal
  2. final_internal_class makes them final
  3. php_unit_test_case_static_method_calls makes all calls to PHPUnit methods use the static keyword, but there is no point in using the static keyword in a final class

I propose to change the default value of the call_type option of the php_unit_test_case_static_method_calls rule from 'static' to 'self'.

Most helpful comment

Perhaps a new fixer for using self instead of static in final classes?

All 4 comments

Perhaps a new fixer for using self instead of static in final classes?

Perhaps a new fixer for using self instead of static in final classes?

While not a bad idea in itself, it does feel like a kind of "brute force solution", and I personally would agree more with the proposed default-change. It's the config that altogether makes the most sense imho, and what I'd use myself anyway.

I think both would be good, however changing the default behaviour would have to target 3.0, whereas a new fixer can target the next minor.

I am no longer interested in this. Feel free to reopen if needed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sennewood picture sennewood  路  3Comments

teohhanhui picture teohhanhui  路  3Comments

datenmeister picture datenmeister  路  3Comments

aidantwoods picture aidantwoods  路  3Comments

grachevko picture grachevko  路  3Comments