Skip to content

Commit

Permalink
Test PropertyAssignRefRule
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Dec 29, 2024
1 parent e8805bd commit a6a6563
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/PHPStan/Rules/Properties/PropertyAssignRefRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ public function testRule(): void
'Property PropertyAssignRef\Foo::$bar with protected(set) visibility is assigned by reference.',
26,
],
[
'Property PropertyAssignRef\Baz::$a with protected visibility is assigned by reference.',
41,
],
[
'Property PropertyAssignRef\Baz::$b with private visibility is assigned by reference.',
42,
],
]);
}

Expand Down
14 changes: 14 additions & 0 deletions tests/PHPStan/Rules/Properties/data/property-assign-ref.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ public function doBar(Foo $foo)
}

}

class Baz
{

protected $a;

private $b;

}

function (Baz $b): void {
$z = &$b->a;
$zz = &$b->b;
};

0 comments on commit a6a6563

Please sign in to comment.