method.break-parameters
Break parameters into multiple lines if the line exceeds the maximum length
WARNING
This rule is deprecated. Please use the method.parameters-linebreak
rule instead.
Options
max
The maximum number of parameter before breaking them into multiple lines
Type: number
Default: 5
Examples
- Examples of correct code for this rule using default options
Parameters are within the limit
php
<?php
function logInfo($first, $second, $third, $fourth, $fifth) {
echo $message;
}
function logError($first, $second, $third) {
echo $message;
}
function logWarning(
$first,
$second,
$third,
$fourth,
$fifth,
$sixth,
$seventh,
$eighth,
) {
echo $message;
}
- Examples of incorrect code for this rule using default options
Parameters exceed the limit
php
<?php
function logInfo($first, $second, $third, $fourth, $fifth, $sixth, $seventh) {
echo $message;
}
function logError($first, $second, $third, $fourth, $fifth, $sixth) {
echo $message;
}
Providing wrong option (less than 2) will throw an error
php
<?php
/* taqwim "taqwim/method.break-parameters": {"max": 1} */
function logInfo($first, $second, $third, $fourth, $fifth, $sixth, $seventh) {
echo $message;
}
function logError($first, $second, $third, $fourth, $fifth, $sixth) {
echo $message;
}
max
- Examples of correct code for this rule using max option
Parameters are within the limit
php
<?php
/* taqwim "taqwim/method.break-parameters" : {max: 3} */
function logInfo($first, $second, $third) {
echo $message;
}
function logError($first) {
echo $message;
}
- Examples of incorrect code for this rule using max option
Parameters exceed the limit
php
<?php
/* taqwim "taqwim/method.break-parameters" : {max: 2} */
function logInfo($first, $second, $third) {
echo $message;
}
function logError($first, $second, $third, $fourth, $fifth) {
echo $message;
}