Hi
On 11/9/25 20:41, Rob Landers wrote:
class P {
private(namespace) function x() {}
}
class C extends P {
protected function x() {}
}
This behaves the same as overriding a private method with a protected/public
one today: the parent’s method is private to its declaring class, so the second
example is allowed.
This is unsound. As we have established, neither `private(namespace)`
nor `protected` is a subset of each other.
Specifically allowing this breaks the following (everything is declared
in the same namespace):
class P {
private(namespace) function x() { }
}
class C extends P {
protected function x() { }
}
function f(P $p) {
$p->x(); // legal, because f is in the same namespace as P.
}
f(new C()); // breaks, because C::x() is protected and thus not
legal to access from f / the global scope.
Best regards
Tim Düsterhus