Skip to content

Commit

Permalink
another test
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Apr 4, 2024
1 parent 739c0f4 commit f440dca
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ protected function getRule(): Rule
'MissingReadOnlyPropertyAssign\\TestCase::setUp',
'Bug10523\\Controller::init',
'Bug10523\\MultipleWrites::init',
'Bug10523\\SingleWriteInConstructorCalledMethod::init',
],
),
);
Expand Down
26 changes: 26 additions & 0 deletions tests/PHPStan/Rules/Properties/data/bug-10523.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,29 @@ private function redirectIfNoShoppingBasketPresent(): void
}

}


final class SingleWriteInConstructorCalledMethod
{
private readonly B $userAccount;

public function __construct()
{
}

public function init(): void
{
$this->redirectIfNkdeCheckoutNotAllowed();
$this->redirectIfNoShoppingBasketPresent();
}

private function redirectIfNkdeCheckoutNotAllowed(): void
{
}

private function redirectIfNoShoppingBasketPresent(): void
{
$this->userAccount = new B();
}

}

0 comments on commit f440dca

Please sign in to comment.