phpstorm-attributes icon indicating copy to clipboard operation
phpstorm-attributes copied to clipboard

[ArrayShape] for maps/associative arrays as dynamic array indexes

Open Justinas-Jurciukonis opened this issue 11 months ago • 1 comments

Right now if I have following attribute

class Shema {
   #[ArrayShape(['string' => Property::class])]
    public array $properties;
}

$schema->properties['prop1'] = new Property();
$shcema->properties['prop2'] = new Property();

PHPStorm (PhpStorm 2023.3.4) will report on key Value should be one of: 'string' (why value?).

Is there any way to show possible index values? Like "string" / "int" / "SomeEnum->getValues()"

Screenshot 2024-02-28 at 10 59 34

Justinas-Jurciukonis avatar Feb 28 '24 11:02 Justinas-Jurciukonis