Skip to content

Commit

Permalink
Feat: Add AssignNullCoalescingToCoalesceEqualFixer (part of #94)
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed Apr 28, 2024
1 parent efd606c commit 6b07446
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/Integration/Fixtures/NewPhpFeatures.correct.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class NewPhpFeatures
$dateOrNull = $this->mayReturnDateTimeOrNull();
$timestamp = $dateOrNull?->getTimestamp(); // RequireNullSafeObjectOperatorSniff

// AssignNullCoalescingToCoalesceEqualFixer
$name = $_GET['name'] ?? 'default';

return $foo;
}

Expand Down
3 changes: 3 additions & 0 deletions tests/Integration/Fixtures/NewPhpFeatures.wrong.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class NewPhpFeatures
$dateOrNull = $this->mayReturnDateTimeOrNull();
$timestamp = $dateOrNull !== null ? $dateOrNull->getTimestamp() : null; // RequireNullSafeObjectOperatorSniff

// AssignNullCoalescingToCoalesceEqualFixer
$name = isset($_GET['name']) ? $_GET['name'] : 'default';

return $foo;
}

Expand Down

0 comments on commit 6b07446

Please sign in to comment.