.. _functions-shouldbetypehinted: .. _argument-should-be-typehinted: Argument Should Be Typehinted +++++++++++++++++++++++++++++ When a method expects objects as argument, those arguments should be typehinted. This way, it provides early warning that a wrong object is being sent to the method. The analyzer will detect situations where a class, or the keywords 'array' or 'callable'. `Closure `_.php>`_ arguments are omitted. .. code-block:: php foo(); } ?> See also `Type declarations `_. Connex PHP features ------------------- + `typehint `_ Suggestions ___________ * Add the typehint to the function arguments Specs _____ +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Short name | Functions/ShouldBeTypehinted | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Changed Behavior `, :ref:`Typechecks ` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.8.4 | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Slow (1 hour) | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | ClearPHP | `always-typehint `__ | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Examples | :ref:`case-dolphin-functions-shouldbetypehinted`, :ref:`case-mautic-functions-shouldbetypehinted` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+-------------------------------------------------------------------------------------------------------------------------+