PHP_CodeSniffer icon indicating copy to clipboard operation
PHP_CodeSniffer copied to clipboard

Add metrics to the `PSR2.ControlStructures.SwitchDeclaration` sniff

Open jrfnl opened this issue 9 months ago • 0 comments

Description

Recreation of upstream PR https://github.com/squizlabs/PHP_CodeSniffer/pull/1542:

I've explicitly not added metrics for:

  • lowercase keyword as those are already recorded by the Generic.PHP.LowerCaseKeyword sniff
  • break/return not on a line by itself as that is already recorded by the Generic.Formatting.DisallowMultipleStatements sniff

Resolves squizlabs/PHP_CodeSniffer#1541

Please let me know if there is anything you'd like me to change (phrasing and such).

Suggested changelog entry

PSR2/SwitchDeclaration: the sniff can now provide some metric on space usage in switch structures for a code base.

jrfnl avatar Nov 08 '23 20:11 jrfnl