.. _classes-uselessconstructor: .. _useless-constructor: Useless Constructor +++++++++++++++++++ Class constructor that have empty bodies are useless. They may be removed, as they are not called. One edge case is when the class has a `parent `_, and the `parent `_ constructor must not be called. Another edge case is promoted properties: the body of the constructor is still empty, but the parameters hold the definitions of properties. These might be better outside the constructor though. .. code-block:: php Related PHP errors ------------------- + `0 `_ Connex PHP features ------------------- + `constructor `_ Suggestions ___________ * Remove the constructor Specs _____ +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Short name | Classes/UselessConstructor | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`Changed Behavior ` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.8.4 | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Slow (1 hour) | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Precision | High | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+-------------------------------------------------------------------------------------------------------------------------+