1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Don’t warn about null array access if we’re ignoring null issues

This commit is contained in:
Matthew Brown 2018-01-12 18:04:11 -05:00
parent 21eafd8bfc
commit 573260b16d
2 changed files with 19 additions and 0 deletions

View File

@ -858,6 +858,10 @@ class FetchChecker
foreach ($array_type->getTypes() as &$type) {
if ($type instanceof TNull) {
if ($array_type->ignore_nullable_issues) {
continue;
}
if ($in_assignment) {
if ($replacement_type) {
if ($array_access_type) {

View File

@ -405,6 +405,21 @@ class FunctionCallTest extends TestCase
'$b' => 'string|false',
],
],
'arrayPopIgnoreNullable' => [
'<?php
function expectsInt(int $a) : void {}
/**
* @param array<mixed, array{item:int}> $list
*/
function test(array $list) : void
{
while (!empty($list)) {
$tmp = array_pop($list);
expectsInt($tmp["item"]);
}
}',
],
];
}