Skip to content

Conversation

@endroid
Copy link
Owner

@endroid endroid commented Oct 21, 2025

…utes

  • Update minimum PHP version from 8.2 to 8.3 in composer.json
  • Update CI workflow to test PHP 8.3, 8.4, and 8.5
  • Add typed class constants (PHP 8.3 feature) to all Writer classes
  • Add #[\Override] attributes (PHP 8.3 feature) to all methods that override parent/interface methods
  • Improve type safety and catch potential refactoring errors at compile time

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Minimum PHP version requirement updated from 8.2 to 8.3
    • Added support for PHP 8.5
    • Improved code quality with explicit type declarations

…utes

- Update minimum PHP version from 8.2 to 8.3 in composer.json
- Update CI workflow to test PHP 8.3, 8.4, and 8.5
- Add typed class constants (PHP 8.3 feature) to all Writer classes
- Add #[\Override] attributes (PHP 8.3 feature) to all methods that override parent/interface methods
- Improve type safety and catch potential refactoring errors at compile time

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@endroid endroid requested a review from Copilot October 21, 2025 07:33
@coderabbitai
Copy link

coderabbitai bot commented Oct 21, 2025

Walkthrough

The project raised its minimum PHP version from 8.2 to 8.3 and added support for PHP 8.5. Throughout the codebase, #[\Override] attributes were added to method declarations and explicit type declarations were applied to public constants across Writer and Result classes.

Changes

Cohort / File(s) Summary
CI and Dependency Configuration
.github/workflows/CI.yml, composer.json
Updated PHP version matrix from [8.2, 8.3, 8.4] to [8.3, 8.4, 8.5]; updated composer.json requirement from ^8.2 to ^8.3.
Writer Classes – Override Attributes
src/Writer/AbstractGdWriter.php, src/Writer/BinaryWriter.php, src/Writer/ConsoleWriter.php, src/Writer/DebugWriter.php, src/Writer/GifWriter.php
Added #[\Override] attribute to write() and validateResult() methods (where applicable) to mark explicit method overrides.
Writer Classes – Override Attributes & Typed Constants
src/Writer/EpsWriter.php, src/Writer/PdfWriter.php, src/Writer/PngWriter.php, src/Writer/SvgWriter.php, src/Writer/WebPWriter.php
Added #[\Override] attribute to write() methods; added explicit type declarations (public const int or public const string) to public constants (e.g., DECIMAL_PRECISION, WRITER_OPTION_*).
Result Classes – Override Attributes
src/Writer/Result/{BinaryResult,ConsoleResult,DebugResult,EpsResult,GdResult,GifResult,PdfResult,PngResult,SvgResult,WebPResult}.php
Added #[\Override] attribute to getString() and getMimeType() methods across all Result classes to mark explicit method overrides.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Rationale: Despite affecting many files, the changes are highly homogeneous and repetitive—systematic addition of PHP 8.3+ #[\Override] attributes and explicit type declarations on constants. No logic modifications, control flow changes, or complex interactions present. The pattern is consistent across all files, allowing efficient review.

Poem

🐰 Our code now speaks with types so clear,
PHP eight-point-three draws near!
With Override marks, no doubts remain—
Each method's purpose, bright and plain.
Eight-point-five awaits ahead,
Type-safe paths where we are led! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Upgrade to PHP 8.3+ and implement typed constants and Override attrib…" directly addresses the three primary changes in the pull request: upgrading the minimum PHP version to 8.3 (reflected in composer.json and CI workflow updates), implementing typed constants across all Writer classes, and adding #[\Override] attributes to overriding methods. The title is concise, specific, and descriptive—avoiding vague or generic language—and clearly communicates the main objectives to someone scanning the commit history.
✨ 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 claude/update-php-support-011CUKu7MxopyeXeuGQUtmGF

📜 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 21e888e and b2f95a2.

📒 Files selected for processing (22)
  • .github/workflows/CI.yml (1 hunks)
  • composer.json (1 hunks)
  • src/Writer/AbstractGdWriter.php (2 hunks)
  • src/Writer/BinaryWriter.php (1 hunks)
  • src/Writer/ConsoleWriter.php (1 hunks)
  • src/Writer/DebugWriter.php (2 hunks)
  • src/Writer/EpsWriter.php (1 hunks)
  • src/Writer/GifWriter.php (1 hunks)
  • src/Writer/PdfWriter.php (1 hunks)
  • src/Writer/PngWriter.php (1 hunks)
  • src/Writer/Result/BinaryResult.php (2 hunks)
  • src/Writer/Result/ConsoleResult.php (2 hunks)
  • src/Writer/Result/DebugResult.php (2 hunks)
  • src/Writer/Result/EpsResult.php (1 hunks)
  • src/Writer/Result/GdResult.php (1 hunks)
  • src/Writer/Result/GifResult.php (2 hunks)
  • src/Writer/Result/PdfResult.php (1 hunks)
  • src/Writer/Result/PngResult.php (2 hunks)
  • src/Writer/Result/SvgResult.php (2 hunks)
  • src/Writer/Result/WebPResult.php (2 hunks)
  • src/Writer/SvgWriter.php (1 hunks)
  • src/Writer/WebPWriter.php (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (20)
src/Writer/Result/GifResult.php (5)
src/Writer/AbstractGdWriter.php (2)
  • Override (30-128)
  • Override (199-212)
src/Writer/GifWriter.php (1)
  • Override (16-23)
src/Writer/Result/GdResult.php (2)
  • Override (23-27)
  • Override (29-33)
src/Writer/Result/PngResult.php (2)
  • Override (20-30)
  • Override (32-36)
src/Writer/Result/WebPResult.php (2)
  • Override (19-30)
  • Override (32-36)
src/Writer/Result/PngResult.php (5)
src/Writer/Result/DebugResult.php (2)
  • Override (32-69)
  • Override (71-75)
src/Writer/Result/EpsResult.php (2)
  • Override (19-23)
  • Override (25-29)
src/Writer/Result/GifResult.php (2)
  • Override (9-16)
  • Override (18-22)
src/Writer/Result/PdfResult.php (2)
  • Override (23-27)
  • Override (29-33)
src/Writer/Result/SvgResult.php (2)
  • Override (24-38)
  • Override (40-44)
src/Writer/ConsoleWriter.php (3)
src/Writer/AbstractGdWriter.php (2)
  • Override (30-128)
  • Override (199-212)
src/Writer/BinaryWriter.php (1)
  • Override (16-23)
src/Writer/DebugWriter.php (2)
  • Override (16-23)
  • Override (25-33)
src/Writer/GifWriter.php (2)
src/Writer/AbstractGdWriter.php (2)
  • Override (30-128)
  • Override (199-212)
src/Writer/Result/GdResult.php (2)
  • Override (23-27)
  • Override (29-33)
src/Writer/DebugWriter.php (3)
src/Writer/BinaryWriter.php (1)
  • Override (16-23)
src/Writer/ConsoleWriter.php (1)
  • Override (16-23)
src/Writer/SvgWriter.php (1)
  • Override (25-76)
src/Writer/Result/BinaryResult.php (5)
src/Writer/Result/DebugResult.php (2)
  • Override (32-69)
  • Override (71-75)
src/Writer/Result/EpsResult.php (2)
  • Override (19-23)
  • Override (25-29)
src/Writer/Result/PdfResult.php (2)
  • Override (23-27)
  • Override (29-33)
src/Writer/Result/PngResult.php (2)
  • Override (20-30)
  • Override (32-36)
src/Writer/Result/SvgResult.php (2)
  • Override (24-38)
  • Override (40-44)
src/Writer/PngWriter.php (2)
src/Writer/AbstractGdWriter.php (2)
  • Override (30-128)
  • Override (199-212)
src/Writer/Result/PngResult.php (2)
  • Override (20-30)
  • Override (32-36)
src/Writer/Result/GdResult.php (5)
src/Writer/AbstractGdWriter.php (2)
  • Override (30-128)
  • Override (199-212)
src/Writer/Result/GifResult.php (2)
  • Override (9-16)
  • Override (18-22)
src/Writer/Result/PngResult.php (2)
  • Override (20-30)
  • Override (32-36)
src/Writer/Result/WebPResult.php (2)
  • Override (19-30)
  • Override (32-36)
src/Writer/Result/ResultInterface.php (1)
  • getString (13-13)
src/Writer/Result/DebugResult.php (6)
src/Writer/DebugWriter.php (2)
  • Override (16-23)
  • Override (25-33)
src/Writer/Result/BinaryResult.php (2)
  • Override (16-30)
  • Override (32-36)
src/Writer/Result/EpsResult.php (2)
  • Override (19-23)
  • Override (25-29)
src/Writer/Result/PdfResult.php (2)
  • Override (23-27)
  • Override (29-33)
src/Writer/Result/PngResult.php (2)
  • Override (20-30)
  • Override (32-36)
src/Writer/Result/SvgResult.php (2)
  • Override (24-38)
  • Override (40-44)
src/Writer/Result/PdfResult.php (6)
src/Writer/Result/BinaryResult.php (2)
  • Override (16-30)
  • Override (32-36)
src/Writer/Result/DebugResult.php (2)
  • Override (32-69)
  • Override (71-75)
src/Writer/Result/EpsResult.php (2)
  • Override (19-23)
  • Override (25-29)
src/Writer/Result/PngResult.php (2)
  • Override (20-30)
  • Override (32-36)
src/Writer/Result/SvgResult.php (2)
  • Override (24-38)
  • Override (40-44)
src/Writer/Result/ResultInterface.php (1)
  • getString (13-13)
src/Writer/Result/WebPResult.php (4)
src/Writer/Result/GdResult.php (2)
  • Override (23-27)
  • Override (29-33)
src/Writer/Result/GifResult.php (2)
  • Override (9-16)
  • Override (18-22)
src/Writer/Result/PngResult.php (2)
  • Override (20-30)
  • Override (32-36)
src/Writer/WebPWriter.php (1)
  • Override (18-29)
src/Writer/SvgWriter.php (6)
src/Writer/BinaryWriter.php (1)
  • Override (16-23)
src/Writer/DebugWriter.php (2)
  • Override (16-23)
  • Override (25-33)
src/Writer/EpsWriter.php (1)
  • Override (18-44)
src/Writer/PdfWriter.php (1)
  • Override (22-110)
src/Writer/PngWriter.php (1)
  • Override (19-43)
src/Writer/Result/SvgResult.php (2)
  • Override (24-38)
  • Override (40-44)
src/Writer/WebPWriter.php (2)
src/Writer/AbstractGdWriter.php (2)
  • Override (30-128)
  • Override (199-212)
src/Writer/Result/WebPResult.php (2)
  • Override (19-30)
  • Override (32-36)
src/Writer/EpsWriter.php (5)
src/Writer/BinaryWriter.php (1)
  • Override (16-23)
src/Writer/DebugWriter.php (2)
  • Override (16-23)
  • Override (25-33)
src/Writer/PdfWriter.php (1)
  • Override (22-110)
src/Writer/PngWriter.php (1)
  • Override (19-43)
src/Writer/SvgWriter.php (1)
  • Override (25-76)
src/Writer/Result/EpsResult.php (7)
src/Writer/EpsWriter.php (1)
  • Override (18-44)
src/Writer/Result/BinaryResult.php (2)
  • Override (16-30)
  • Override (32-36)
src/Writer/Result/DebugResult.php (2)
  • Override (32-69)
  • Override (71-75)
src/Writer/Result/PdfResult.php (2)
  • Override (23-27)
  • Override (29-33)
src/Writer/Result/PngResult.php (2)
  • Override (20-30)
  • Override (32-36)
src/Writer/Result/SvgResult.php (2)
  • Override (24-38)
  • Override (40-44)
src/Writer/Result/ResultInterface.php (1)
  • getString (13-13)
src/Writer/PdfWriter.php (4)
src/Writer/BinaryWriter.php (1)
  • Override (16-23)
src/Writer/DebugWriter.php (2)
  • Override (16-23)
  • Override (25-33)
src/Writer/PngWriter.php (1)
  • Override (19-43)
src/Writer/SvgWriter.php (1)
  • Override (25-76)
src/Writer/AbstractGdWriter.php (9)
src/Writer/BinaryWriter.php (1)
  • Override (16-23)
src/Writer/ConsoleWriter.php (1)
  • Override (16-23)
src/Writer/DebugWriter.php (2)
  • Override (16-23)
  • Override (25-33)
src/Writer/GifWriter.php (1)
  • Override (16-23)
src/Writer/PngWriter.php (1)
  • Override (19-43)
src/Writer/Result/GdResult.php (2)
  • Override (23-27)
  • Override (29-33)
src/Writer/Result/PngResult.php (2)
  • Override (20-30)
  • Override (32-36)
src/Writer/Result/WebPResult.php (2)
  • Override (19-30)
  • Override (32-36)
src/Writer/WebPWriter.php (1)
  • Override (18-29)
src/Writer/BinaryWriter.php (6)
src/Writer/AbstractGdWriter.php (2)
  • Override (30-128)
  • Override (199-212)
src/Writer/ConsoleWriter.php (1)
  • Override (16-23)
src/Writer/DebugWriter.php (2)
  • Override (16-23)
  • Override (25-33)
src/Writer/EpsWriter.php (1)
  • Override (18-44)
src/Writer/PdfWriter.php (1)
  • Override (22-110)
src/Writer/PngWriter.php (1)
  • Override (19-43)
src/Writer/Result/SvgResult.php (5)
src/Writer/Result/BinaryResult.php (2)
  • Override (16-30)
  • Override (32-36)
src/Writer/Result/DebugResult.php (2)
  • Override (32-69)
  • Override (71-75)
src/Writer/Result/EpsResult.php (2)
  • Override (19-23)
  • Override (25-29)
src/Writer/Result/PdfResult.php (2)
  • Override (23-27)
  • Override (29-33)
src/Writer/Result/PngResult.php (2)
  • Override (20-30)
  • Override (32-36)
src/Writer/Result/ConsoleResult.php (3)
src/Writer/Result/DebugResult.php (2)
  • Override (32-69)
  • Override (71-75)
src/Writer/Result/EpsResult.php (2)
  • Override (19-23)
  • Override (25-29)
src/Writer/Result/ResultInterface.php (1)
  • getMimeType (19-19)
🔇 Additional comments (31)
src/Writer/Result/WebPResult.php (2)

19-30: Correct use of #[\Override] attribute.

The #[\Override] attribute correctly indicates that getString() overrides the parent GdResult::getString() method, improving type safety and catching potential refactoring errors at compile time.


32-36: Correct use of #[\Override] attribute.

The #[\Override] attribute correctly indicates that getMimeType() overrides the parent GdResult::getMimeType() method.

src/Writer/Result/PdfResult.php (1)

23-33: Correct use of #[\Override] attributes.

Both getString() and getMimeType() correctly use the #[\Override] attribute to indicate they override parent AbstractResult methods, consistent with the pattern applied across all Result classes in this PR.

src/Writer/Result/BinaryResult.php (1)

16-36: Correct use of #[\Override] attributes.

Both getString() and getMimeType() correctly use the #[\Override] attribute to indicate they override parent AbstractResult methods.

src/Writer/Result/GifResult.php (1)

9-22: Correct use of #[\Override] attributes.

Both getString() and getMimeType() correctly use the #[\Override] attribute to indicate they override parent GdResult methods, consistent with other GD-based result classes (PngResult, WebPResult).

src/Writer/DebugWriter.php (2)

16-23: Correct use of #[\Override] attribute.

The #[\Override] attribute correctly indicates that write() implements the WriterInterface::write() method.


25-33: Correct use of #[\Override] attribute.

The #[\Override] attribute correctly indicates that validateResult() implements the ValidatingWriterInterface::validateResult() method.

src/Writer/Result/DebugResult.php (2)

32-69: Correct use of #[\Override] attribute.

The #[\Override] attribute correctly indicates that getString() overrides the parent AbstractResult::getString() method.


71-75: Correct use of #[\Override] attribute.

The #[\Override] attribute correctly indicates that getMimeType() overrides the parent AbstractResult::getMimeType() method.

.github/workflows/CI.yml (1)

10-10: CI matrix update approved—PHP 8.5 availability confirmed.

PHP 8.5 is available in shivammathur/setup-php as of October 2025 (as a nightly/dev build). The CI matrix changes correctly align with the new minimum PHP 8.3 requirement.

composer.json (1)

15-15: PHP 8.3 requirement verified and approved.

The project's single external dependency, bacon/bacon-qr-code at version ^3.0, requires PHP ^8.1 and is fully compatible with the new PHP ^8.3 requirement. No compatibility issues identified.

src/Writer/GifWriter.php (1)

16-17: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as overriding AbstractGdWriter::write(). This improves type safety by catching refactoring errors at compile time.

src/Writer/Result/ConsoleResult.php (3)

12-17: LGTM - Typed constant enhances type safety.

The explicit array type on the TWO_BLOCKS constant leverages PHP 8.3's typed constants feature, providing compile-time type verification.


39-43: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as implementing ResultInterface::getMimeType().


45-70: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as implementing ResultInterface::getString().

src/Writer/BinaryWriter.php (1)

16-23: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as implementing WriterInterface::write(), ensuring compile-time verification of the interface contract.

src/Writer/ConsoleWriter.php (1)

16-23: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as implementing WriterInterface::write().

src/Writer/AbstractGdWriter.php (2)

30-128: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as implementing WriterInterface::write().


199-212: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as implementing ValidatingWriterInterface::validateResult().

src/Writer/Result/SvgResult.php (2)

24-38: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as implementing ResultInterface::getString().


40-44: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as implementing ResultInterface::getMimeType().

src/Writer/Result/GdResult.php (2)

23-27: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as implementing ResultInterface::getString(). The method intentionally throws an exception, expecting concrete subclasses (GifResult, PngResult, WebPResult) to override it.


29-33: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as implementing ResultInterface::getMimeType(). The method intentionally throws an exception, expecting concrete subclasses to override it.

src/Writer/Result/PngResult.php (2)

20-30: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as overriding GdResult::getString(), which itself implements ResultInterface::getString().


32-36: LGTM - Correct use of Override attribute.

The #[\Override] attribute correctly marks this method as overriding GdResult::getMimeType(), which itself implements ResultInterface::getMimeType().

src/Writer/Result/EpsResult.php (1)

19-29: LGTM! Proper use of #[\Override] attribute.

The #[\Override] attributes correctly indicate that these methods implement the ResultInterface contract. This improves maintainability by catching potential signature mismatches at compile time.

src/Writer/EpsWriter.php (1)

16-44: LGTM! Proper PHP 8.3+ type safety improvements.

The explicit int type on the DECIMAL_PRECISION constant and the #[\Override] attribute on the write() method are correctly applied. These changes enhance type safety and help catch refactoring errors at compile time.

src/Writer/WebPWriter.php (1)

16-29: LGTM! Consistent type safety enhancements.

The explicit string type on the constant and the #[\Override] attribute are correctly applied. These changes align with the PHP 8.3+ upgrade objectives and maintain consistency with other Writer classes.

src/Writer/PdfWriter.php (1)

16-110: LGTM! Comprehensive type safety improvements.

All five WRITER_OPTION constants are correctly typed as string, and the #[\Override] attribute properly indicates the interface implementation. These changes enhance compile-time type checking and maintain consistency with the broader codebase upgrade.

src/Writer/PngWriter.php (1)

16-43: LGTM! Proper type annotations applied.

The explicit string types on both WRITER_OPTION constants and the #[\Override] attribute are correctly applied. These metadata changes improve type safety without altering functionality.

src/Writer/SvgWriter.php (1)

18-76: LGTM! Comprehensive PHP 8.3+ type safety upgrade.

All constant type declarations are accurate (int for DECIMAL_PRECISION, string for all WRITER_OPTION constants), and the #[\Override] attribute correctly indicates the interface implementation. These changes provide excellent compile-time guarantees without modifying behavior.


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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades the minimum PHP version from 8.2 to 8.3 and adopts new PHP 8.3 language features to improve type safety and code maintainability.

Key Changes:

  • Updates minimum PHP version requirement to 8.3 and adjusts CI matrix to test versions 8.3, 8.4, and 8.5
  • Adds typed class constants to all Writer classes for improved compile-time type checking
  • Adds #[\Override] attributes to all overridden methods for better refactoring safety

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.

File Description
composer.json Updated minimum PHP version from 8.2 to 8.3
.github/workflows/CI.yml Updated CI test matrix to PHP 8.3, 8.4, and 8.5
src/Writer/*.php Added #[\Override] attributes and typed constants to all Writer classes
src/Writer/Result/*.php Added #[\Override] attributes to getString() and getMimeType() methods

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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