fopen_flags.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ====================
  2. Rule ``fopen_flags``
  3. ====================
  4. The flags in ``fopen`` calls must omit ``t``, and ``b`` must be omitted or
  5. included consistently.
  6. .. warning:: Using this rule is risky.
  7. Risky when the function ``fopen`` is overridden.
  8. Configuration
  9. -------------
  10. ``b_mode``
  11. ~~~~~~~~~~
  12. The ``b`` flag must be used (``true``) or omitted (``false``).
  13. Allowed types: ``bool``
  14. Default value: ``true``
  15. Examples
  16. --------
  17. Example #1
  18. ~~~~~~~~~~
  19. *Default* configuration.
  20. .. code-block:: diff
  21. --- Original
  22. +++ New
  23. @@ -1,2 +1,2 @@
  24. <?php
  25. -$a = fopen($foo, 'rwt');
  26. +$a = fopen($foo, 'rwb');
  27. Example #2
  28. ~~~~~~~~~~
  29. With configuration: ``['b_mode' => false]``.
  30. .. code-block:: diff
  31. --- Original
  32. +++ New
  33. @@ -1,2 +1,2 @@
  34. <?php
  35. -$a = fopen($foo, 'rwt');
  36. +$a = fopen($foo, 'rw');
  37. Rule sets
  38. ---------
  39. The rule is part of the following rule sets:
  40. @Symfony:risky
  41. Using the ``@Symfony:risky`` rule set will enable the ``fopen_flags`` rule with the config below:
  42. ``['b_mode' => false]``
  43. @PhpCsFixer:risky
  44. Using the ``@PhpCsFixer:risky`` rule set will enable the ``fopen_flags`` rule with the config below:
  45. ``['b_mode' => false]``