[php-src] Issue #14384: String Array Cast
| From: | rela589n | Date: | Fri, 31 May 2024 09:41:06 +0000 |
| Subject: | [php-src] Issue #14384: String Array Cast | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246991@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14384
Author: rela589n
### Description
Hi there!
I would like to propose the feature that would allow to cast an array of objects into an array of
strings:
```php
/** @var Uuid[] $templateIds */
$templateIdStrings = (string[])$templateIds;
```
Basically this is a syntax sugar to a more verbose form identical to this:
```
/** @var Uuid[] $templateIds */
$templateIdStrings = array_map(static fn (Uuid $value): string => (string)$value, $templateIds);
```
Please, let me know what you think about it.