foreach (['foo', 'bar', 'baz'] as $required) {
if (!array_key_exists($required, $data)) {
throw new InvalidArgumentException('Missing required attribute: ' . $required);
}
}
echo $data['foo']; // This line generates an error saying that Offset 'foo' does not exist
Feature request
See the following for an example: https://phpstan.org/r/4a390276-8f42-45ba-9b3a-b3102a3955c7
Would it be possible to support the more dynamic checking of
array_key_exists?