Can you type hint an associative array? Permanently deleted user 创建于 2017年08月11日 18:42 Hi, I'm trying to type hint an associative array with different type of values such as the following array $testObject['keyA'] = new Object1; $testObject['keyB'] = new Object2; Is this even possible?
Old question, but: I don't think so. Best I came up with is `/** @var $testObject (Object1|Object2)[] */`. There is an issue at https://youtrack.jetbrains.com/issue/WI-5223 and a plugin (which I did not test) for PhpStorm to partially support a suitable (experimental) syntax: https://plugins.jetbrains.com/plugin/7822-options-completion-plugin