From c1f670cf24354bf9ee2c72c33565ec5a0a165b6f Mon Sep 17 00:00:00 2001 From: William Storey Date: Sun, 27 Sep 2026 19:03:48 +0000 Subject: [PATCH] Fix PHPStan alreadyNarrowedType error in value-limit test PHPStan 2.2.16 remembers the result of a method call after an assertion. It reported the second assertSame() on the same get() call as always true. Store each lookup result in its own variable so that PHPStan checks both results. Co-Authored-By: Claude Opus 5.5 --- tests/MaxMind/Db/Test/ReaderTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/MaxMind/Db/Test/ReaderTest.php b/tests/MaxMind/Db/Test/ReaderTest.php index 11c258d..399fa0d 100644 --- a/tests/MaxMind/Db/Test/ReaderTest.php +++ b/tests/MaxMind/Db/Test/ReaderTest.php @@ -419,8 +419,10 @@ public function testValueCountAtLimitDecodes(): void // the same reader, because the budget belongs to one call. $expected = array_fill(0, 65535, 0); $reader = new Reader('tests/data/test-data/MaxMind-DB-test-decoder-value-limit.mmdb'); - $this->assertSame($expected, $reader->get('1.1.1.1')); - $this->assertSame($expected, $reader->get('1.1.1.1')); + $first = $reader->get('1.1.1.1'); + $second = $reader->get('1.1.1.1'); + $this->assertSame($expected, $first); + $this->assertSame($expected, $second); $reader->close(); // 65,535 values reached through a depth-15 pointer fan-out. Under the