no_trailing_comma_in_singleline_array.rst 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. ==============================================
  2. Rule ``no_trailing_comma_in_singleline_array``
  3. ==============================================
  4. PHP single-line arrays should not have trailing comma.
  5. Warning
  6. -------
  7. This rule is deprecated and will be removed in the next major version
  8. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. You should use ``no_trailing_comma_in_singleline`` instead.
  10. Examples
  11. --------
  12. Example #1
  13. ~~~~~~~~~~
  14. .. code-block:: diff
  15. --- Original
  16. +++ New
  17. <?php
  18. -$a = array('sample', );
  19. +$a = array('sample');
  20. References
  21. ----------
  22. - Fixer class: `PhpCsFixer\\Fixer\\ArrayNotation\\NoTrailingCommaInSinglelineArrayFixer <./../../../src/Fixer/ArrayNotation/NoTrailingCommaInSinglelineArrayFixer.php>`_
  23. - Test class: `PhpCsFixer\\Tests\\Fixer\\ArrayNotation\\NoTrailingCommaInSinglelineArrayFixerTest <./../../../tests/Fixer/ArrayNotation/NoTrailingCommaInSinglelineArrayFixerTest.php>`_
  24. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.