diff --git a/bin/functionMetadata_original.php b/bin/functionMetadata_original.php index 618ec3b44f..f6e054a756 100644 --- a/bin/functionMetadata_original.php +++ b/bin/functionMetadata_original.php @@ -36,6 +36,7 @@ 'array_replace' => ['hasSideEffects' => false], 'array_replace_recursive' => ['hasSideEffects' => false], 'array_reverse' => ['hasSideEffects' => false], + 'array_shift' => ['hasSideEffects' => true], 'array_slice' => ['hasSideEffects' => false], 'array_sum' => ['hasSideEffects' => false], 'array_udiff' => ['hasSideEffects' => false], diff --git a/resources/functionMetadata.php b/resources/functionMetadata.php index 4aefe1f0d2..eb1774bf3c 100644 --- a/resources/functionMetadata.php +++ b/resources/functionMetadata.php @@ -702,6 +702,7 @@ 'array_replace_recursive' => ['hasSideEffects' => false], 'array_reverse' => ['hasSideEffects' => false], 'array_search' => ['hasSideEffects' => false], + 'array_shift' => ['hasSideEffects' => true], 'array_slice' => ['hasSideEffects' => false], 'array_sum' => ['hasSideEffects' => false], 'array_udiff' => ['hasSideEffects' => false], diff --git a/tests/PHPStan/Analyser/NodeScopeResolverTest.php b/tests/PHPStan/Analyser/NodeScopeResolverTest.php index 43efba4291..c629aed2f7 100644 --- a/tests/PHPStan/Analyser/NodeScopeResolverTest.php +++ b/tests/PHPStan/Analyser/NodeScopeResolverTest.php @@ -1170,6 +1170,7 @@ public function dataFileAsserts(): iterable yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-8635.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-8625.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-8621.php'); + yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-8084.php'); } /** diff --git a/tests/PHPStan/Analyser/data/bug-8084.php b/tests/PHPStan/Analyser/data/bug-8084.php new file mode 100644 index 0000000000..d21d9a0f18 --- /dev/null +++ b/tests/PHPStan/Analyser/data/bug-8084.php @@ -0,0 +1,16 @@ +