Skip to content

Conversation

@jackd248
Copy link
Owner

@jackd248 jackd248 commented Nov 24, 2025

Summary by CodeRabbit

  • New Features

    • Extended DocBlock insertion to properly recognize and handle PHP 8.2 readonly modifiers, ensuring consistent behavior with other class modifiers.
  • Tests

    • Added comprehensive test coverage for readonly modifier scenarios in class declarations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 24, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The changes extend the DocBlockHeaderFixer to handle PHP 8.2's readonly modifier alongside existing modifiers (final, abstract, attributes). The implementation adds T_READONLY token checks in two locations for DocBlock insertion logic. Three corresponding test methods verify readonly modifier behavior in class declarations.

Changes

Cohort / File(s) Change Summary
Implementation
src/Rules/DocBlockHeaderFixer.php
Added T_READONLY token type to modifier checks in two locations, treating readonly modifiers consistently with other class modifiers (final/abstract/attribute) for DocBlock insertion point detection.
Test Coverage
tests/src/Rules/DocBlockHeaderFixerTest.php
Added three new PHPUnit test methods guarded by PHP 8.2+ requirement: testFindInsertPositionWithReadonlyModifier (verifies readonly modifier detection), testFindInsertPositionWithFinalReadonlyModifiers (verifies modifier ordering with both final and readonly), and testApplyFixAddsDocBlockToFinalReadonlyClass (verifies DocBlock insertion before modifiers).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Consistent, homogeneous pattern of adding a single token type to existing checks
  • Three test cases follow established testing patterns in the file
  • No changes to public method signatures or exported logic

Possibly related PRs

Poem

🐰 Classes now sport their readonly dress,
With proper docs—no DocBlock mess!
From final friends, this modifier grew,
PHP 8.2 shines bright and new! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch readonly-fix

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cfb2ea4 and d7ab806.

📒 Files selected for processing (2)
  • src/Rules/DocBlockHeaderFixer.php (2 hunks)
  • tests/src/Rules/DocBlockHeaderFixerTest.php (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jackd248 jackd248 merged commit 792d266 into main Nov 24, 2025
11 of 14 checks passed
@coveralls
Copy link

Pull Request Test Coverage Report for Build 19636954555

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 19636509185: 0.0%
Covered Lines: 264
Relevant Lines: 264

💛 - Coveralls

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.

3 participants