Skip to content

chore: apply Rector null-coalescing assignment rule from newer tool versions - #862

Merged
kishore7snehil merged 1 commit into
mainfrom
chore/rector-null-coalescing-assign
Aug 31, 2026
Merged

chore: apply Rector null-coalescing assignment rule from newer tool versions#862
kishore7snehil merged 1 commit into
mainfrom
chore/rector-null-coalescing-assign

Conversation

@kishore7snehil

@kishore7snehil kishore7snehil commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Changes

CI installs its dev tools from open version ranges and there is no committed composer.lock, so it recently pulled in a newer Rector (2.6.x). That version enables IfToNullCoalescingAssignRector, which is why the Rector job started failing on unrelated PRs.

  • The rule rewrites if (null === $x) { $x = ...; } guards to $x ??= ..., which is equivalent.
  • This affected four pre-existing spots: src/Token.php, src/Token/Parser.php, src/Utility/HttpResponsePaginator.php, and src/Utility/HttpTelemetry.php.
  • In src/Token/Parser.php the @codeCoverageIgnore markers were kept around the rewritten line, since it remains untestable with the current JWT encoding test libraries.
  • Behavior is unchanged.

References

Unblocks the Rector CI job on open PRs (#852, #853, #861).

Testing

  • This change adds unit test coverage
  • This change has been tested on the latest version of the platform/language

Contributor Checklist

Rector 2.6.x's IfToNullCoalescingAssignRector flags four pre-existing
if (null === $x) { $x = ... } guards. composer.lock is not committed, so
CI now resolves the newer Rector and the dry-run gate fails on every open
PR until these are updated.
@kishore7snehil
kishore7snehil requested a review from a team as a code owner August 31, 2026 09:20
@kishore7snehil
kishore7snehil merged commit 74d502c into main Aug 31, 2026
21 checks passed
@kishore7snehil
kishore7snehil deleted the chore/rector-null-coalescing-assign branch August 31, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants