.. _variables-constanttypo: .. _constant-typo-looks-like-a-variable: Constant Typo Looks Like A Variable +++++++++++++++++++++++++++++++++++ A constant bears the same name as a variable. This might be a typo. When the constant doesn't exist, PHP 8.0 yields a Fatal `Error `_ and stops execution. PHP 7.4 turns the undefined constant into its string equivalent. This analysis is case sensitive. .. code-block:: php doSomething(); } ?> Connex PHP features ------------------- + `constant `_ + `variable `_ Suggestions ___________ * Add a $ sign to the constant * Use a different name for the variable, or the constant Specs _____ +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Short name | Variables/ConstantTypo | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`Changed Behavior ` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 2.2.0 | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | PHP Version | With PHP 8.0 and older | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Precision | Medium | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Related rule | :ref:`undefined-constants` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+-------------------------------------------------------------------------------------------------------------------------+