267 $printJob->state = PrintJob::SUCCESS;
268 return redirect()->back()->with('message', __('general.successful_modification'));
269 } else {
270 Log::warning("cannot cancel print job " . $printJob->job_id ." for unknown reasons: " . var_dump($result));271 return redirect()->back()->with('error', __('general.unknown_error'));
272 }
273 }
The function call is not valid, which will result in a fatal runtime error.
This issue will be raised for any of the following cases:
Please refer to the occurrence message for each instance to understand how it could be fixed.
function sum(int $a, int $b) {
return $a + $b;
}
sum(1); // invalid: the function is invoked with 1 argument, 2 were expected
function sum(int $a, int $b) {
return $a + $b;
}
sum('1', 2); // invalid: argument #1 ($a) must be of type int, string given
function sum(int $a, int $b) {
return $a + $b;
}
sum(a: 1); // invalid: the function is invoked with 1 argument, 2 were expected
function incre(int &$a) {
$a++;
}
incre(1); // invalid: a reference was expected, but an expression was passed instead
The number and types of parameters passed in must match the number of required parameters the function expects:
function sum(int $a, int $b) {
return $a + $b;
}
sum(1, 2);
Pass in all required parameters when using the named parameter syntax:
function sum(int $a, int $b) {
return $a + $b;
}
sum(a: 1, b: 2);
If a function marks its parameters as references, only variables must be passed to it:
function incre(int &$a) {
$a++;
}
$a = 1;
incre($a);