.. _functions-uselessargument: .. _useless-argument: Useless Argument ++++++++++++++++ The argument is always used with the same value. This value could be hard coded in the method, and save one argument slot. There is no indication that this argument will be used with other values. It may be a development artifact, that survived without cleaning. Methods with less than 3 calls are not considered here, to avoid reporting methods used once. Also, arguments with a default value are omitted. The chances of useless arguments decrease with the number of usage. The parameter ``maxUsageCount`` prevents highly called methods (more than the parameter value) to be processed. .. code-block:: php +---------------+---------+---------+---------------------------------------------------------------------------------------+ | Name | Default | Type | Description | +---------------+---------+---------+---------------------------------------------------------------------------------------+ | maxUsageCount | 30 | integer | Maximum count of function usage. Use this to limit the amount of processed arguments. | +---------------+---------+---------+---------------------------------------------------------------------------------------+ See also `class `_. Connex PHP features ------------------- + `class `_ Suggestions ___________ * Remove the argument and hard code its value inside the method * Add the value as default in the method signature, and drop it from the calls * Add calls to the method, with more varied arguments Specs _____ +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Short name | Functions/UselessArgument | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`Changed Behavior ` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 1.8.0 | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Precision | High | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+-------------------------------------------------------------------------------------------------------------------------+