-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix false positives about uninitialized properties
- Loading branch information
Showing
4 changed files
with
419 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php // lint >= 8.1 | ||
|
||
namespace Bug10523; | ||
|
||
final class Controller | ||
{ | ||
private readonly B $userAccount; | ||
|
||
public function __construct() | ||
{ | ||
$this->userAccount = new B(); | ||
} | ||
|
||
public function init(): void | ||
{ | ||
$this->redirectIfNkdeCheckoutNotAllowed(); | ||
$this->redirectIfNoShoppingBasketPresent(); | ||
} | ||
|
||
private function redirectIfNkdeCheckoutNotAllowed(): void | ||
{ | ||
|
||
} | ||
|
||
private function redirectIfNoShoppingBasketPresent(): void | ||
{ | ||
$x = $this->userAccount; | ||
} | ||
|
||
} | ||
|
||
class B {} | ||
|
||
final class MultipleWrites | ||
{ | ||
private readonly B $userAccount; | ||
|
||
public function __construct() | ||
{ | ||
$this->userAccount = new B(); | ||
} | ||
|
||
public function init(): void | ||
{ | ||
$this->redirectIfNkdeCheckoutNotAllowed(); | ||
$this->redirectIfNoShoppingBasketPresent(); | ||
} | ||
|
||
private function redirectIfNkdeCheckoutNotAllowed(): void | ||
{ | ||
} | ||
|
||
private function redirectIfNoShoppingBasketPresent(): void | ||
{ | ||
$this->userAccount = new B(); | ||
} | ||
|
||
} | ||
|
||
|
||
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(); | ||
} | ||
|
||
} |
Oops, something went wrong.