This rule reports an error when a function returns by reference.
Returning by reference lets the caller change state that the function keeps, which makes the code harder to follow. Return a value instead.
<?php
declare(strict_types=1);
function &values(): array
{
static $values = [];
return $values;
}<?php
declare(strict_types=1);
function values(): array
{
return [];
}By default, this rule is enabled, unless you set the allRules parameter to false.
You can set the enabled parameter to false to disable this rule.
parameters:
ergebnis:
noReturnByReference:
enabled: false💡 The enabled parameter for noReturnByReference also enables or disables the following rules: