Proposal in provided link https://wiki.php.net/rfc/typed-properties has status declined.
The proposal implemented in php7.4 is here https://wiki.php.net/rfc/typed_properties_v2 and there's an explanation about callable
:
The callable type is not supported, because its behavior is context
dependent The following example illustrates the issue:
class Test {
public callable $cb;
public function __construct() {
// $this->cb is callable here
$this->cb = [$this, 'method'];
}
private function method() {}
}
$obj = new Test;
// $obj->cb is NOT callable here
($obj->cb)();
This means that it is possible to write a legal value to a property
and then proceed to read an illegal value from the same property. This
fundamental problem of the callable
pseudo-type is laid out in much
more detail in the consistent callables RFC.
The recommended workaround is to instead use the Closure
type, in
conjunction with Closure::fromCallable()
. This ensures that the
callable will remain callable independent of scope. For a discussion
of alternative ways to handle the callable issue, see the Alternatives
section.
List of all implemented proposals for php7.4 is here https://wiki.php.net/rfc#php_74.