.. _classes-uselessassignationofpromotedproperty: .. _useless-assignation-of-promoted-property: Useless Assignation Of Promoted Property ++++++++++++++++++++++++++++++++++++++++ Promoted properties save the assignation of constructor argument to the property. It is useless to do it with that syntax, and in the constructor too. .. code-block:: php a = $a; // This is the traditional way (up to PHP 8.0) $this->b = $b; } } ?> Suggestions ___________ * Remove the assignation in the constructor Specs _____ +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Classes/UselessAssignationOfPromotedProperty | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`Changed Behavior `, :ref:`Class Review ` | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 2.5.0 | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | With PHP 8.0 and more recent | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Features | promoted-property | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+