Skip to content

Commit

Permalink
Fix UselessPrivatePropertyNullabilityRule false-positive for promoted…
Browse files Browse the repository at this point in the history
… properties (#55)
  • Loading branch information
enumag authored Dec 2, 2022
1 parent 3a3f8b1 commit 01f9cd9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Rule/UselessPrivatePropertyNullabilityRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function processNode(Node $node, Scope $scope): array
$errors = [];

foreach ($node->getProperties() as $property) {
$shouldBeChecked = $property->isPrivate() || $property->isReadOnly();
$shouldBeChecked = ($property->isPrivate() || $property->isReadOnly()) && !$property->isPromoted();

if (!$shouldBeChecked) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public function __construct(
int $isPrivate,
int $isPrivateWithConditionalAssignment,
int $isPrivateWithDefaultNull,
int $isPrivateWithDefaultNotNull
int $isPrivateWithDefaultNotNull,
private ?int $isPrivatePromoted
) {
$this->isPublic = $isPublic;
$this->isProtected = $isProtected;
Expand Down

0 comments on commit 01f9cd9

Please sign in to comment.