Skip to content

Regression test #1740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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 {}