Skip to content

Commit 848ac1a

Browse files
Add scenario
1 parent 21bcb53 commit 848ac1a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/PHPStan/Rules/Methods/data/bug-12224.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,21 @@ public function string(mixed $value): string
2929
}
3030
}
3131

32+
class AssertConstructor
33+
{
34+
/**
35+
* @phpstan-assert string $value
36+
*/
37+
public function __construct(mixed $value)
38+
{
39+
if (!\is_string($value)) {
40+
throw new \RuntimeException();
41+
}
42+
}
43+
}
44+
3245
/** @var string|null $a */
3346
$a = '';
3447
Assert::staticString($a);
3548
(new Assert())->string($a);
49+
new AssertConstructor($a);

0 commit comments

Comments
 (0)