Skip to content

Commit a6a6563

Browse files
committed
Test PropertyAssignRefRule
1 parent e8805bd commit a6a6563

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tests/PHPStan/Rules/Properties/PropertyAssignRefRuleTest.php

+8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ public function testRule(): void
3333
'Property PropertyAssignRef\Foo::$bar with protected(set) visibility is assigned by reference.',
3434
26,
3535
],
36+
[
37+
'Property PropertyAssignRef\Baz::$a with protected visibility is assigned by reference.',
38+
41,
39+
],
40+
[
41+
'Property PropertyAssignRef\Baz::$b with private visibility is assigned by reference.',
42+
42,
43+
],
3644
]);
3745
}
3846

tests/PHPStan/Rules/Properties/data/property-assign-ref.php

+14
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,17 @@ public function doBar(Foo $foo)
2727
}
2828

2929
}
30+
31+
class Baz
32+
{
33+
34+
protected $a;
35+
36+
private $b;
37+
38+
}
39+
40+
function (Baz $b): void {
41+
$z = &$b->a;
42+
$zz = &$b->b;
43+
};

0 commit comments

Comments
 (0)