L.S.,

I just noticed something which seems odd to me: PHP 8.1 deprecated declaring a function to return by reference when the return type is void:

`function &foo() : void {}` results in:
"Deprecated: foo(): Returning by reference from a void function is deprecated"

However, declaring a function to return by reference when the return type is "never" does not yield either an error or a deprecation notice: https://3v4l.org/DWs7t

I might well be missing something, but this feels a bit strange and inconsistent to me.

Should this be fixed by also deprecating return by reference for "never" functions ?

Smile,
Juliette





Reply via email to