Skip to content

Commit

Permalink
Regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanvelzen authored and ondrejmirtes committed Sep 22, 2022
1 parent 4b22f3d commit d4b720d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Expand Up @@ -433,4 +433,10 @@ public function testBug4526(): void
$this->analyse([__DIR__ . '/data/bug-4526.php'], []);
}

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

}
21 changes: 21 additions & 0 deletions tests/PHPStan/Rules/Properties/data/bug-7200.php
@@ -0,0 +1,21 @@
<?php declare(strict_types = 1);

namespace Bug7200;

class HelloWorld
{
/**
* @param class-string<Model&One&Two&Three>|null $class
*/
public function __construct(public ?Model $model = null, public ?string $class = null)
{
if ($model instanceof One && $model instanceof Two && $model instanceof Three) {
$this->class ??= $model::class;
}
}
}

class Model {}
interface One {}
interface Two {}
interface Three {}

0 comments on commit d4b720d

Please sign in to comment.