Hi Internals, I'd like to kick off a conversation to capture everyone else's thoughts on tweaking / improving typed properties for arrays (for a PHP 8.x release).
With all the work done lately to greatly improve the type support in PHP (which is amazing by the way), I'm finding for the most part, I'm no longer needing to Docblock as much of my code which is lovely. That said, there's a common use case that keeps me going back to them which I think would be a good thing for PHP to try and solve as a language feature - better typing of arrays to type their properties. IDEs like PHPStorm handle this structure already hence sticking to that as a starting point... @returns []int This would designate the return of an array where all its keys are that of the int type, but it works for any type. With that in mind, it might also make sense to allow a shorthand array alias for array types anyway - array -> []. To use actual PHP examples, this would mean the following would be supported: // Typed array properties ...values would follow any existing PHO type function returnsIntArray(): []int; function returnsClassArray(): []Class; // The same outcome function returnsArray(): array; function returnsArray(): []; I welcome all your thoughts on this proposal. Many thanks, Aran