From 648dda67ed7aca1d4ea243258f0ee7f2844ac60a Mon Sep 17 00:00:00 2001 From: Brown Date: Wed, 25 Sep 2019 13:12:29 -0400 Subject: [PATCH] Fix Psalm issues --- .../Statements/Expression/Fetch/ArrayFetchAnalyzer.php | 5 ++++- src/Psalm/Internal/Codebase/Populator.php | 2 +- tests/ArrayAssignmentTest.php | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php index 252fd5902..c3ef46795 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php @@ -348,7 +348,10 @@ class ArrayFetchAnalyzer if ($in_assignment) { $offset_type->removeType('null'); - $offset_type->addType(new TLiteralInt(0)); + + if (!$offset_type->ignore_nullable_issues) { + $offset_type->addType(new TLiteralInt(0)); + } } } diff --git a/src/Psalm/Internal/Codebase/Populator.php b/src/Psalm/Internal/Codebase/Populator.php index 3f77ac8bd..b8c3fe2a7 100644 --- a/src/Psalm/Internal/Codebase/Populator.php +++ b/src/Psalm/Internal/Codebase/Populator.php @@ -269,7 +269,7 @@ class Populator $declaring_class_storages = []; foreach ($overridden_method_ids as $declaring_method_id) { - list($declaring_class, $declaring_method_name) = explode('::', $declaring_method_id); + list($declaring_class) = explode('::', $declaring_method_id); $declaring_class_storage = $declaring_class_storages[$declaring_class] = $this->classlike_storage_provider->get($declaring_class); diff --git a/tests/ArrayAssignmentTest.php b/tests/ArrayAssignmentTest.php index 1d47e611c..f6f17c316 100644 --- a/tests/ArrayAssignmentTest.php +++ b/tests/ArrayAssignmentTest.php @@ -1117,7 +1117,7 @@ class ArrayAssignmentTest extends TestCase return $array; }', ], - 'coerceNullKeyToZero' => [ + 'coercePossiblyNullKeyToZero' => [ '