[php-src] Issue #11817: Revive ArrayOf[] Syntax RFC For Strict Arrays - Please!!! (Originally published in 2014)
| From: | danbadds38 | Date: | Fri, 28 Jul 2023 20:02:47 +0000 |
| Subject: | [php-src] Issue #11817: Revive ArrayOf[] Syntax RFC For Strict Arrays - Please!!! (Originally published in 2014) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245059@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11817
Author: danbadds38
### Description
It was originally proposed in (2014) it's now (2023) and I know EVERYONE would love this
feature.
Original RFC: https://wiki.php.net/rfc/arrayof
Original PR: https://github.com/php/php-src/pull/562/files
To keep my applications strictly typed I had to create my own Abstract Classes and use Reflections
on DocBlocks to analyze class methods using RegEx, and perform the type checking.
Works great, but not as fast as native C-level runtimes.
Everyone wants to be able to do something like this! Especially with the mainstream use of ORM
```php
public function getUsersByName(string $name): Users[];
```
or
leverage some array collection of objects.
```php
public function dispatchEvents(Event[] $events): void;
```