Skip to content

Commit

Permalink
Regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 20, 2024
1 parent 473df92 commit e94a9fc
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/PHPStan/Rules/PhpDoc/MethodAssertRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,9 @@ public function testBug10573(): void
$this->analyse([__DIR__ . '/data/bug-10573.php'], []);
}

public function testBug10214(): void
{
$this->analyse([__DIR__ . '/data/bug-10214.php'], []);
}

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

namespace Bug10241;

interface Common {
/** @phpstan-assert-if-true A $this */
public function isA(): bool;

/** @phpstan-assert-if-true B $this */
public function isB(): bool;
}

trait IsCommon {
public function isA(): bool {
return $this instanceof A;
}

public function isB(): bool {
return $this instanceof B;
}
}

class A implements Common
{
use IsCommon;


public function isApple(): bool
{
return true;
}
}

class B implements Common
{
use IsCommon;

public function isBanana(): bool
{
return true;
}
}

0 comments on commit e94a9fc

Please sign in to comment.