new_with_braces.rst 714 B

123456789101112131415161718192021222324252627282930313233
  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. @@ -1 +1 @@
  13. -<?php $x = new X;
  14. +<?php $x = new X();
  15. Rule sets
  16. ---------
  17. The rule is part of the following rule sets:
  18. @PSR12
  19. Using the `@PSR12 <./../../ruleSets/PSR12.rst>`_ rule set will enable the ``new_with_braces`` rule.
  20. @PhpCsFixer
  21. Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``new_with_braces`` rule.
  22. @Symfony
  23. Using the `@Symfony <./../../ruleSets/Symfony.rst>`_ rule set will enable the ``new_with_braces`` rule.