[php-src] Issue #24161: Null coalescing pipe operator
| From: | rela589n | Date: | Tue, 06 Oct 2026 09:15:48 +0000 |
| Subject: | [php-src] Issue #24161: Null coalescing pipe operator | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252913@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/24161
Author: rela589n
### Description
I sometimes find it better to chain validation methods that never return a value in the pipe.
For example:
```php
class User
{
public string $email {
set => $value |?> Assert::email(?);
}
}
```
This
Assert::email() accepts and validates the $value, returns
void:
```php
// class Assert
//
public static function email($value): void
{
```
Currently, the same is possible with a more verbose form like this:
```php
class User
{
public string $email {
set {
Assert::email($value);
$this->email = $value;
}
}
}
```
However, IMO such chain $value |?> Assert::email(?) would be better