How to use PHPCBF to fix one issue at a time?



PHP Snippet 1:

./www/vendor/bin/phpcbf www/application --standard=Generic --sniffs=Generic.PHP.LowerCaseConstant

PHP Snippet 2:

phpcbf --standard=path_to_your_ruleset_file.xml

PHP Snippet 3:

<rule ref="Drupal.Commenting.FunctionComment">
  <exclude name="Drupal.Commenting.FunctionComment.Missing"/>
  <exclude name="Drupal.Commenting.FunctionComment.MissingFile"/>
  <exclude name="Drupal.Commenting.FunctionComment.MissingParamType"/>
  <exclude name="Drupal.Commenting.FunctionComment.WrongStyle"/>
  <exclude name="Drupal.Commenting.FunctionComment.ParamCommentNewLine"/>
  <exclude name="Drupal.Commenting.FunctionComment.IncorrectParamVarName"/>
  <exclude name="Drupal.Commenting.FunctionComment.SpacingAfter"/>
  <exclude name="Drupal.Commenting.FunctionComment.SpacingAfterParamType"/>
</rule>

PHP Snippet 4:

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 291 | ERROR | [x] There must not be a space between the question mark and the type in nullable type declarations
     |       |     (PSR12.Functions.NullableTypeDeclaration.WhitespaceFound)

PHP Snippet 5:

./vendor/bin/phpcbf src/File.php --sniffs="PSR12.Functions.NullableTypeDeclaration"

PHP Snippet 6:

./vendor/bin/phpcs -e

PHP Snippet 7:

Generic (15 sniffs)
-------------------
  Generic.ControlStructures.InlineControlStructure
  Generic.Files.ByteOrderMark
  Generic.Files.LineEndings
  Generic.Files.LineLength
  Generic.Formatting.DisallowMultipleStatements
  Generic.Functions.FunctionCallArgumentSpacing
  Generic.NamingConventions.UpperCaseConstantName
  Generic.PHP.DisallowAlternativePHPTags
  Generic.PHP.DisallowShortOpenTag
  Generic.PHP.LowerCaseConstant
  Generic.PHP.LowerCaseKeyword
  Generic.PHP.LowerCaseType
  Generic.WhiteSpace.DisallowTabIndent
  Generic.WhiteSpace.IncrementDecrementSpacing
  Generic.WhiteSpace.ScopeIndent

PEAR (1 sniff)
---------------
  PEAR.Functions.ValidDefaultValue

PSR1 (3 sniffs)
---------------
  PSR1.Classes.ClassDeclaration
  PSR1.Files.SideEffects
  PSR1.Methods.CamelCapsMethodName

PSR2 (9 sniffs)
---------------
  PSR2.Classes.ClassDeclaration
  PSR2.Classes.PropertyDeclaration
  PSR2.ControlStructures.ElseIfDeclaration
  PSR2.ControlStructures.SwitchDeclaration
  PSR2.Files.ClosingTag
  PSR2.Files.EndFileNewline
  PSR2.Methods.FunctionCallSignature
  PSR2.Methods.FunctionClosingBrace
  PSR2.Methods.MethodDeclaration

Squiz (15 sniffs)
-----------------
  Squiz.Classes.ValidClassName
  Squiz.ControlStructures.ControlSignature
  Squiz.ControlStructures.ForEachLoopDeclaration
  Squiz.ControlStructures.ForLoopDeclaration
  Squiz.ControlStructures.LowercaseDeclaration
  Squiz.Functions.FunctionDeclaration
  Squiz.Functions.FunctionDeclarationArgumentSpacing
  Squiz.Functions.LowercaseFunctionKeywords
  Squiz.Functions.MultiLineFunctionDeclaration
  Squiz.Scope.MethodScope
  Squiz.WhiteSpace.CastSpacing
  Squiz.WhiteSpace.ControlStructureSpacing
  Squiz.WhiteSpace.ScopeClosingBrace
  Squiz.WhiteSpace.ScopeKeywordSpacing
  Squiz.WhiteSpace.SuperfluousWhitespace