[php-src] Issue #23093: First class callable syntax for instance methods
[email protected] (rela589n)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
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).