StyleCI Blog

New PHP Fixers

March 05, 2020

We have made some changes to our PHP fixing platform today, mostly to allow us to improve PSR12 support.

  1. We have renamed our braces fixer to psr12_braces and we have tweaked it so that single-line closure syntax is now permitted. You can still enable/disable this fixer using its old name, for now. In light of this change, we have introduced a new fixer psr2_braces, which behaves just like the psr12_braces fixer, but insists on closures having PSR2 style braces. The psr12_braces and psr2_braces fixers cannot both be enabled at the same time - enable one or the other, or neither.
  2. We have added a new method_argument_space_strict fixer which behaves just like our existing method_argument_space fixer, but additionally enforces that if parameters span more than one line, each must be on its own line, in accordence with PSR12. The method_argument_space and method_argument_space_strict fixers cannot both be enabled at the same time - enable one or the other, or neither.
  3. We have now marked the no_unneeded_final_method fixer as risky, due its behaviour on private final methods that are overriting methods in a parent class.

Our presets have thus changed in the following way:

  1. Our none preset remains the same. It enables no rules.
  2. Our psr1 preset remains the same. It enables the same three rules as previously.
  3. Our psr2 preset has been updated. We have removed the braces fixer and added the psr2_braces fixer.
  4. Our psr12 preset has been updated. We have removed the braces and method_argument_space fixers and added the concat_with_spaces, method_argument_space_strict, and psr12_braces fixers.
  5. Our symfony preset has been updated. We have removed the braces and method_argument_space fixers and added the method_argument_space_strict and psr12_braces fixers.
  6. Our laravel preset has been updated. We have removed the braces fixer and added the psr2_braces fixer.
  7. Our recommended preset has been updated. We have removed the braces and method_argument_space fixers and added the method_argument_space_strict and psr12_braces fixers.

Please do get in touch with us if you have any questions or comments!



© 2023 Graham Campbell Technology Ltd. All rights reserved.