Skip to content

method.max-parameters

Ensure that a method or function does not have too many parameters

Options

max

The maximum number of parameters a method or function can have

Type: number

Default: 5

Examples

  • Examples of correct code for this rule using default options

Functions parameters are within the limit

php
<?php
function test($a, $b, $c, $d, $e) {
	echo $a;
}
  • Examples of incorrect code for this rule using default options

Function parameters are more than the limit

php
<?php
function test($a, $b, $c, $d, $e, $f, $g, $h, $i, $j) {
	echo $a;
}

Provided configuration is not valid

php
<?php
/* taqwim "taqwim/method.max-parameters": {"max": 1} */
function test($a, $b, $c, $d, $e, $f, $g, $h, $i, $j) {
	echo $a;
}

Released under the MIT License.