Hello, internals! I just want to share some thoughts with you regarding what could be improved in the first class callable syntax.
It is already possible to create Callable from a static method: ``` class Foo { public static function staticmethod() {} } $c = Foo::staticmethod(...); ``` It would be a great pleasure to have the ability to wrap the instance method the same way. One particular use case for this could be when there's an array of items and it is necessary to call some getter-method on all of them. ``` class Verification { public function __construct(private string $id) {} public function getId(): string { return $this->id; } } $items = [new Verification('1-2-3-4')]; array_map(Verification::getId(...), $items); // previous line is an equivalent of this array_map(static fn (Verification $v) => $v->getId(), $items); ``` Currently this syntax fails in run-time rather than compile-time. ``` PHP Fatal error: Uncaught Error: Non-static method Verification::getId() cannot be called statically in /opt/scratches/scratch_439.php:21 ``` Please, let me know what you think about it. Best regards, Yeven