Skip to content

Commit

Permalink
Regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 18, 2021
1 parent 82a4c8b commit 5de358a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -450,4 +450,10 @@ public function testBug1707(): void
$this->analyse([__DIR__ . '/data/bug-1707.php'], []);
}

public function testBug3357(): void
{
$this->checkAlwaysTrueStrictComparison = true;
$this->analyse([__DIR__ . '/data/bug-3357.php'], []);
}

}
21 changes: 21 additions & 0 deletions tests/PHPStan/Rules/Comparison/data/bug-3357.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Bug3357;

function (): void {
/**
* @var array{foo?: string}
*/
$foo = [];

assert($foo === []);
};

function (): void {
/**
* @var array{foo: string, bar?: string}
*/
$foo = ['foo' => ''];

assert($foo === ['foo' => '']);
};

0 comments on commit 5de358a

Please sign in to comment.