-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InvalidArrayOffset reported for array_keys() keys #10382
Comments
I found these snippets: https://psalm.dev/r/6c6ea1b229<?php
/** @param array<mixed> $config */
function foo (array $config): array {
$bar = [];
foreach (array_keys($config['connections']) as $name) {
$bar[$name] = 'hmm';
}
return $bar;
}
|
You need to validate that you pass an array to the |
I found these snippets: https://psalm.dev/r/409ee9c8ec<?php
/** @param array<mixed> $config */
function foo (array $config): array {
$bar = [];
if (!isset($config['connections']) || !is_array($config['connections'])) {
throw new RuntimeException;
}
foreach (array_keys($config['connections']) as $name) {
$bar[$name] = 'hmm';
}
return $bar;
}
|
ostrolucky
added a commit
to doctrine/DoctrineBundle
that referenced
this issue
Jan 28, 2024
ostrolucky
added a commit
to doctrine/DoctrineBundle
that referenced
this issue
Jan 28, 2024
ostrolucky
added a commit
to doctrine/DoctrineBundle
that referenced
this issue
Jan 28, 2024
ostrolucky
added a commit
to doctrine/DoctrineBundle
that referenced
this issue
Jan 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://psalm.dev/r/6c6ea1b229
OG issue at https://github.com/doctrine/DoctrineBundle/pull/1728/files#diff-afe5f060789287a8ad428a4b5df1ad844184f496ece0297e421f6b1fc442b5a4
The text was updated successfully, but these errors were encountered: