lint/control-flow/no-return-assignment
In the dead-code set. Safe fix.
What it does
Local, dynamic and directly referenced variables should not be assigned and directly returned by a function or method.
Configuration
[lint.rules]
"control-flow/no-return-assignment" = "error"
To skip it in some files, add an override or a @pun-ignore-file comment.
Options
| Name | Type | Allowed values | Default | Upstream name |
|---|---|---|---|---|
skip-named-var-tags |
bool |
Any | false |
skip_named_var_tags |
skip-commented |
bool |
Any | false |
None (Pun’s own) |
Replaces
return_assignment(php-cs-fixer)SimplifyUselessVariable(rector)inline-variable-return(mago-linter)
Merged rules
These old IDs are now this rule. A config that still names one stops with an error. See merged rules.
lint/dead-code/no-useless-variable
Rector’s SimplifyUselessVariableRector leaves an assignment alone when a comment is before it, or when a comment before the return names the variable or has @var. skip-commented = true does the same; pun migrate sets it when the rule comes from rector.php and not from PHP-CS-Fixer’s return_assignment.