Skip to content

Commit

Permalink
test we don't emit unreachable branch error
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Dec 21, 2022
1 parent efbf266 commit d724ad9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Expand Up @@ -91,4 +91,10 @@ public function testReportPhpDoc(): void
]);
}

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

}
21 changes: 21 additions & 0 deletions tests/PHPStan/Rules/Comparison/data/bug-3019.php
@@ -0,0 +1,21 @@
<?php

namespace Bug3019;

trait FooTrait
{
public function doFoo(): void
{
$key = __CLASS__ === 'Bug3019\Foo' ? 'display' : 'layout';
}
}

class Foo
{
use FooTrait;
}

class Bar
{
use FooTrait;
}

0 comments on commit d724ad9

Please sign in to comment.