[php-src] Issue #13398: Add possibility for create, type for 'Array of types'

From: Date: Thu, 15 Feb 2024 13:28:01 +0000
Subject: [php-src] Issue #13398: Add possibility for create, type for 'Array of types'
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246461@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13398 Author: PatrykKuniczak ### Description Issue like that on stack: https://stackoverflow.com/questions/38828696/php-accept-only-array-of-specific-class TS reference: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#arrays ```php class Test { public function __construct() { } } $tests = [['test' => new Test(), 'test2' => new Test()]]; And type could be e.g {string => Test}[] and for standard Array $tests2 = ['asd', 2, []] as mixed[] ``` I was looking for that possibility. :)

« previous php.bugs (#246461) next »