Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Analyser/MutatingScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -4816,7 +4816,7 @@ public function isInFirstLevelStatement(): bool

public function mergeWith(?self $otherScope): self
{
if ($otherScope === null) {
if ($otherScope === null || $this === $otherScope) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($otherScope === null || $this === $otherScope) {
if ($otherScope === null || $this === $otherScope || $this->equals($otherScope)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the suggested change will make the test-suite fail with


There was 1 failure:

1) PHPStan\Analyser\NodeScopeResolverTest::testFile with data set "tests/PHPStan/Analyser/nsrt/unset-conditional-expressions.php" ('/Users/staabm/workspace/phpst...ns.php')
Failed assertions in /Users/staabm/workspace/phpstan-src/tests/PHPStan/Analyser/nsrt/unset-conditional-expressions.php:

Line 27:
Expected: array<string, mixed>
Actual:   array{}

/Users/staabm/workspace/phpstan-src/tests/PHPStan/Analyser/NodeScopeResolverTest.php:298

return $this;
}
$ourExpressionTypes = $this->expressionTypes;
Expand Down
Loading