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:
parent
21eafd8bfc
commit
573260b16d
@ -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) {
|
||||
|
@ -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"]);
|
||||
}
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user