.. _patterns-courrierantipattern: .. _courier-anti-pattern: Courier Anti-Pattern ++++++++++++++++++++ The courier anti-pattern is the storage of a dependency by a class, in order to create an instance that requires this dependency. The class itself doesn't actually need this dependency, but has a dependency to a class that requires it. The alternative here is to inject Foo instead of Bar. .. code-block:: php courier = $courier; } public function Afoo() { $b = new Foo($this->courier); } } ?> See also `Courier Anti-pattern `_. Connex PHP features ------------------- + `pattern `_ Specs _____ +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Patterns/CourrierAntiPattern | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Appinfo `, :ref:`CE `, :ref:`Changed Behavior ` | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.11.6 | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Community Edition `_, `Exakat Cloud `_ | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+