Hi internals,
Based on the discussion of "Property accessor hooks, take 2" and the
set-hook argument type - I got to wonder why we still define "no type"
as `mixed`.
As the pseudo type `mixed` exists since PHP 8.0, which is already
out-of-date, I have the feeling it would be better to force people to
explicitly write `mixed` to widen the type of an overwritten function
and let "no type" inherit the argument and return type of the parent.
Example:
class A {
public function typed(int $var): int { return $var; }
public function untyped($var) { return $var; } // implicit mixed as
no overwrite
}
class B extends A {
public function typed($var) { return $var; } // implicit int as
inherited from overwritten function
}
class C extends A {
public function typed(mixed $var):mixed { return $var; } //
explicit mixed to widen the type
}
That do you think?
This is just something that come to mind without having the knowledge
nor time for this kind of RFC or implementation.
Greetings,
Marc