.. _namespaces-aliasconfusion: .. _possible-alias-confusion: Possible Alias Confusion ++++++++++++++++++++++++ An alias is used for a class that doesn't belong to the current namespace, while there is such a class. This also applies to traits and interfaces. When no alias is used, PHP will search for a class in the local space. Since classes, traits and interfaces are usually stored one per file, it is a valid syntax to create an alias, even if this alias name is the name of a class in the same namespace. Yet, with an alias referring to a remote class, while a local one is available, it is possible to generate confusion. .. code-block:: php Connex PHP features ------------------- + `semantics `_ Suggestions ___________ * Avoid using existing classes names for alias * Use a coding convention to distinguish alias from names Specs _____ +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Namespaces/AliasConfusion | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Changed Behavior `, :ref:`Semantics `, :ref:`Suggestions ` | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 2.1.2 | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+