Skip to content

Commit 6e50e88

Browse files
committed
add 5551 test
1 parent ea87672 commit 6e50e88

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

tests/PHPStan/Rules/Properties/TypesAssignedToPropertiesRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ public function testAppendendArrayKey(): void
271271
]);
272272
}
273273

274+
public function testBug5551(): void
275+
{
276+
$this->analyse([__DIR__ . '/data/bug-5551.php'], []);
277+
}
278+
274279
public function testBug5372Two(): void
275280
{
276281
$this->analyse([__DIR__ . '/../Arrays/data/bug-5372_2.php'], []);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Bug5551;
4+
5+
class Foo
6+
{
7+
/**
8+
* @var WeakMap<\stdClass, \stdClass>
9+
*/
10+
protected static WeakMap $bug;
11+
12+
/**
13+
* @var WeakMap<\stdClass, \stdClass>
14+
*/
15+
protected WeakMap $ok;
16+
17+
public function bug(): void
18+
{
19+
$this->ok = new WeakMap();
20+
static::$bug = new WeakMap();
21+
}
22+
}

0 commit comments

Comments
 (0)