Skip to content
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
11 changes: 11 additions & 0 deletions tests/PHPStan/Rules/Classes/ImpossibleInstanceOfRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,4 +556,15 @@ public function testNewIsAlwaysFinalClass(): void
]);
}

public function testBug13469(): void
{
$this->treatPhpDocTypesAsCertain = false;
$this->analyse([__DIR__ . '/data/bug-13469.php'], [
[
'Instanceof between Bug13469\Foo and Stringable will always evaluate to true.',
23,
],
]);
}

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

namespace Bug13469;

use Stringable;

trait FooTrait
{
public function __toString(): string
{
return 'foo';
}
}

class Foo
{
use FooTrait;
}

function doFoo() {
$foo = new Foo();

var_dump($foo instanceof Stringable);
}

Loading