no_php4_constructor.rst 1022 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ============================
  2. Rule ``no_php4_constructor``
  3. ============================
  4. Convert PHP4-style constructors to ``__construct``.
  5. .. warning:: Using this rule is risky.
  6. Risky when old style constructor being fixed is overridden or overrides
  7. parent one.
  8. Examples
  9. --------
  10. Example #1
  11. ~~~~~~~~~~
  12. .. code-block:: diff
  13. --- Original
  14. +++ New
  15. @@ -1,7 +1,7 @@
  16. <?php
  17. class Foo
  18. {
  19. - public function Foo($bar)
  20. + public function __construct($bar)
  21. {
  22. }
  23. }
  24. Rule sets
  25. ---------
  26. The rule is part of the following rule sets:
  27. @PHP80Migration:risky
  28. Using the `@PHP80Migration:risky <./../../ruleSets/PHP80MigrationRisky.rst>`_ rule set will enable the ``no_php4_constructor`` rule.
  29. @PhpCsFixer:risky
  30. Using the `@PhpCsFixer:risky <./../../ruleSets/PhpCsFixerRisky.rst>`_ rule set will enable the ``no_php4_constructor`` rule.
  31. @Symfony:risky
  32. Using the `@Symfony:risky <./../../ruleSets/SymfonyRisky.rst>`_ rule set will enable the ``no_php4_constructor`` rule.