fopen_flags.rst 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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
  7. -------
  8. Using this rule is risky
  9. ~~~~~~~~~~~~~~~~~~~~~~~~
  10. Risky when the function ``fopen`` is overridden.
  11. Configuration
  12. -------------
  13. ``b_mode``
  14. ~~~~~~~~~~
  15. The ``b`` flag must be used (``true``) or omitted (``false``).
  16. Allowed types: ``bool``
  17. Default value: ``true``
  18. Examples
  19. --------
  20. Example #1
  21. ~~~~~~~~~~
  22. *Default* configuration.
  23. .. code-block:: diff
  24. --- Original
  25. +++ New
  26. <?php
  27. -$a = fopen($foo, 'rwt');
  28. +$a = fopen($foo, 'rwb');
  29. Example #2
  30. ~~~~~~~~~~
  31. With configuration: ``['b_mode' => false]``.
  32. .. code-block:: diff
  33. --- Original
  34. +++ New
  35. <?php
  36. -$a = fopen($foo, 'rwt');
  37. +$a = fopen($foo, 'rw');
  38. Rule sets
  39. ---------
  40. The rule is part of the following rule sets:
  41. - `@PhpCsFixer:risky <./../../ruleSets/PhpCsFixerRisky.rst>`_ with config:
  42. ``['b_mode' => false]``
  43. - `@Symfony:risky <./../../ruleSets/SymfonyRisky.rst>`_ with config:
  44. ``['b_mode' => false]``