new_with_braces.rst 699 B

1234567891011121314151617181920212223242526272829303132
  1. ========================
  2. Rule ``new_with_braces``
  3. ========================
  4. All instances created with new keyword must be followed by braces.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. -<?php $x = new X;
  13. +<?php $x = new X();
  14. Rule sets
  15. ---------
  16. The rule is part of the following rule sets:
  17. @PSR12
  18. Using the `@PSR12 <./../../ruleSets/PSR12.rst>`_ rule set will enable the ``new_with_braces`` rule.
  19. @PhpCsFixer
  20. Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``new_with_braces`` rule.
  21. @Symfony
  22. Using the `@Symfony <./../../ruleSets/Symfony.rst>`_ rule set will enable the ``new_with_braces`` rule.