JetBrains / JetBrains/phpstorm-attributes

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

Open
#27 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
416
Forks
11
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.