increment_style.rst 1023 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ========================
  2. Rule ``increment_style``
  3. ========================
  4. Pre- or post-increment and decrement operators should be used if possible.
  5. Configuration
  6. -------------
  7. ``style``
  8. ~~~~~~~~~
  9. Whether to use pre- or post-increment and decrement operators.
  10. Allowed values: ``'post'``, ``'pre'``
  11. Default value: ``'pre'``
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. *Default* configuration.
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. <?php
  21. -$a++;
  22. -$b--;
  23. +++$a;
  24. +--$b;
  25. Example #2
  26. ~~~~~~~~~~
  27. With configuration: ``['style' => 'post']``.
  28. .. code-block:: diff
  29. --- Original
  30. +++ New
  31. <?php
  32. -++$a;
  33. ---$b;
  34. +$a++;
  35. +$b--;
  36. Rule sets
  37. ---------
  38. The rule is part of the following rule sets:
  39. @PhpCsFixer
  40. Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``increment_style`` rule with the default config.
  41. @Symfony
  42. Using the `@Symfony <./../../ruleSets/Symfony.rst>`_ rule set will enable the ``increment_style`` rule with the default config.