71424[TASK] Re-enable php-cs-fixer "static_lambda" rule
Commit message
Review
-
Code review CR 0
-
Verified V 0
Issues 2
Files 3
Review log 1214
-
Nikita Hovratov uploaded patch set 1 10/04/21, 08:08
-
core-ci voted on patch set 1 V -1 10/04/21, 08:12 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17534
-
Nikita Hovratov uploaded patch set 2 10/04/21, 08:21
-
Andreas Kienast commented on patch set 2 10/04/21, 08:29
@Helmut: you found the issue behind this, can you please take a look? -
core-ci voted on patch set 2 V +1 10/04/21, 08:34 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17535
-
Torben Hansen voted on patch set 2 V +1 CR +1 10/04/21, 09:00
-
Simon Schaufelberger voted on patch set 2 V +1 CR +1 10/04/21, 09:24
-
Simon Gilli voted on patch set 2 V +1 CR +1 10/04/21, 10:03
-
Wouter Wolters voted on patch set 2 V +1 CR +1 10/04/21, 17:40
-
Helmut Hummel voted on patch set 2 CR -2 10/04/21, 18:33
-
Helmut Hummel commented on patch set 2 10/04/21, 20:11
There are multiple reasons why I voted -2 here. First of all we're a few hours before a LTS release and I would like to have a proper discussion on this case without any pressure or hurry. Also there is no immediate need for such change. In case we decide later we want to use this fixer, it is trival to activate and run it on our code base. Nothing is really broken without this change. Conceptual considerations: php-cs-fixer delivers multiple fixers. some of them are considered "risky". "risky" means, in some cases (that are not detectable by static analysis) changing the code by this rule might actually break the code. TYPO3 has risky fixers enabled at some point (to allow no_alias_functions) and since then more risky fixers have been added: dir_constant modernize_types_casting no_alias_functions php_unit_construct php_unit_mock_short_will_return php_unit_test_case_static_method_calls and lately: static_lambda Until the latter, we have not been bitten by any of the above fixers. But they are marked as risky for a reason, which has been demonstrated to us with the bug introduced by applying this rule. Because of the nature of these rules, I would now argue that we might need a new workflow, which does NOT enforce these on every change request, but to only casually apply them manually and manually check the result. In any case I think we should discuss this in the team how we want to deal with it and whether we need a new workflow for any of these fixers or not. Until then I would suggest to not change the fixer configuration, at least not add more risky fixers for now. If we find out, that this (and other fixers) can stay enabled, then we can merge this change of course. -
Nikita Hovratov commented on patch set 2 10/05/21, 06:08
Reply
Thank you Helmut for your in depth explanation. I also think there is no hurry to bring this in 11.5.0. Regarding the risky part: It is often written in the PHP-Cs-Fixer rules, what exactly might be risky. For static_lambda it is for example: Risky when using ->bindTo on lambdas without referencing to $this. https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/function_notation/static_lambda.rst So there should be an emphasized look at this. -
Christian Kuhn commented on patch set 2 11/04/21, 16:47
Hey. It seems Helmut and Nikita agree this is problematic in v11 and there is currently no good settlement on how to continue. I hope it's ok to abandon this approach for now - we can of course resurrect the patch for v12 again if reasons changed. -
Christian Kuhn abandoned the change 11/04/21, 16:47