Skip to content

Commit b63cb8a

Browse files
committed
Add test for anon class with typehint properties
1 parent b1d7c85 commit b63cb8a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Tests/VariableAnalysisSniff/fixtures/AnonymousClassWithPropertiesFixture.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,28 @@ public function methodWithStaticVar() {
4141
echo static::$storedHello;
4242
}
4343
};
44+
45+
class ClassWithAnonymousClassAndTypeHints
46+
{
47+
int $main_id = 1;
48+
public int $id = 1;
49+
public \My\Data|bool $data;
50+
51+
public function test_1(): object
52+
{
53+
return new class
54+
{
55+
int $main_id = 1;
56+
public int $id = 123456;
57+
public \My\Data|bool $data;
58+
};
59+
}
60+
61+
public function test_2(): object
62+
{
63+
return new class
64+
{
65+
public $id = 123456;
66+
};
67+
}
68+
}

0 commit comments

Comments
 (0)