[php-src] Issue #23093: First class callable syntax for instance methods
| From: | rela589n | Date: | Thu, 06 Aug 2026 16:06:15 +0000 |
| Subject: | [php-src] Issue #23093: First class callable syntax for instance methods | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252552@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/23093
Author: rela589n
### Description
Consider the following code:
```php
class Booking
{
public function getFreeCancellationDeadline(): ?\DateTimeImmutable
{
// ....
}
}
```
Then, you'd like to have a closure:
```php
fn (Booking $b): ?\DateTimeImmutable => $b->getFreeCancellationDeadline();
```
It would be much neater to have it like this:
```php
Booking::getFreeCancellationDeadline(...);
```
This is the exact form in which PhpStorm IDE copies the method reference ("Copy Reference"
on the method - Ctrl+Alt+Sft+C).