Skip to content

Commit 1fc157e

Browse files
committed
Update bug-12597.php
1 parent aaa670c commit 1fc157e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/PHPStan/Rules/Variables/data/bug-12597.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,33 @@ public function test(int $type): void
2020

2121
public function message(string $message): void {}
2222
}
23+
24+
class HelloWorld2
25+
{
26+
public function test(mixed $type): void
27+
{
28+
if (is_int($type) || is_object($type)) {
29+
$message = 'Hello!';
30+
}
31+
32+
if (is_int($type)) {
33+
$this->message($message);
34+
}
35+
}
36+
37+
public function test2(mixed $type): void
38+
{
39+
if ($type instanceof Foo || $type instanceof Bar) {
40+
$message = 'Hello!';
41+
}
42+
43+
if ($type instanceof Foo) {
44+
$this->message($message);
45+
}
46+
}
47+
48+
public function message(string $message): void
49+
{
50+
}
51+
}
52+

0 commit comments

Comments
 (0)