Re: Typed array properties V2

From: Date: Fri, 24 Jan 2020 19:27:05 +0000
Subject: Re: Typed array properties V2
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-108233@lists.php.net to get a copy of this message
Thus far we have discussed that implementation of type checking for arrays would be too costly from a performance perspective and that there is no good solution that is not extremely complicated to implement. Given that, can we consider an alternative? ALLOW the use of a syntax for typed arrays — whether it be type[] or [type] — but only validate that it is an array and that the "type" is in fact a type, but don't actually validate that each element is the correct type. This would allow those of us who want to start documenting specific usage using type hints to be able to do so instead of what we currently have to do is PHPDoc one way and type hint with "array." It would also allow IDEs like PhpStorm to add support. Is this something the PHP community would consider? -Mike

« previous php.internals (#108233) next »