increment_style.rst 835 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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'`` and ``'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 <./../../ruleSets/PhpCsFixer.rst>`_
  40. - `@Symfony <./../../ruleSets/Symfony.rst>`_