Skip to content

Move DiCompileModule from src-deprecated to src#122

Merged
koriym merged 3 commits into1.xfrom
remove-deprecated-annotation
Oct 27, 2025
Merged

Move DiCompileModule from src-deprecated to src#122
koriym merged 3 commits into1.xfrom
remove-deprecated-annotation

Conversation

@koriym
Copy link
Member

@koriym koriym commented Oct 27, 2025

Summary

DiCompileModule is not deprecated. It serves a different purpose than CompilerModule and is still actively needed.

Problem

The @deprecated Use CompilerModule annotation is incorrect because:

Different Purposes

  • DiCompileModule: Controls whether compilation is enabled/disabled via bool parameter
    • new DiCompileModule(true) → enable compilation
    • new DiCompileModule(false) → disable compilation
  • CompilerModule: Always enables compilation AND configures additional bindings
    • Requires $scriptDir parameter
    • Binds @ScriptDir annotation
    • Binds InjectorInterface to CompiledInjector

Use Cases

  • DiCompileModule(false) is commonly used in dev/test contexts where compilation should be disabled
  • CompilerModule cannot replace this use case since it always sets @Compile to true

Changes

  • ✅ Remove @deprecated annotation
  • ✅ Move from src-deprecated/ to src/ (it's not deprecated)
  • ✅ Make class final (Psalm requirement)
  • ✅ Add #[Override] attribute (Psalm requirement)
  • ✅ All tests passing
  • ✅ Static analysis clean

🤖 Generated with Claude Code

Summary by Sourcery

Reinstate DiCompileModule by removing its deprecated status, moving it into the active source tree, and updating its class definition to satisfy Psalm requirements

Enhancements:

  • Remove incorrect deprecation annotation from DiCompileModule
  • Move DiCompileModule from src-deprecated to src
  • Mark DiCompileModule as final and add #[Override] for static analysis compliance

Chores:

  • Ensure all tests pass and static analysis is clean

Summary by CodeRabbit

  • Refactor

    • Modernized codebase to use PHP 8 attributes, removed deprecated docblocks, and finalized core module classes.
  • Chores

    • Updated CI to target PHP 8.4, simplified analysis/tooling configuration and scoped analysis to project source paths; CI workflow now runs manually instead of on every pull request.

DiCompileModule and CompilerModule serve different purposes:
- DiCompileModule: Controls compilation on/off via bool parameter
- CompilerModule: Always enables compilation and configures script directory

DiCompileModule is still actively needed for cases where compilation
needs to be conditionally disabled (e.g., dev mode vs prod mode).

Changes:
- Remove incorrect @deprecated annotation
- Move from src-deprecated/ to src/
- Make class final
- Add #[Override] attribute

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

Co-Authored-By: Claude <[email protected]>
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 27, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR un-deprecates and moves DiCompileModule into the main src directory, applies PSalm-driven updates (final class, Override attribute import), and ensures all tests and static analysis checks pass.

Class diagram for updated DiCompileModule

classDiagram
    class DiCompileModule {
        - bool doCompile
        + __construct(bool doCompile, AbstractModule module = null)
        + configure() void
    }
    DiCompileModule --|> AbstractModule
    class DiCompileModule {
        <<final>>
        <<Override>>
    }
Loading

File-Level Changes

Change Details Files
Remove incorrect deprecation marker and relocate DiCompileModule
  • Deleted @deprecated annotation
  • Moved file from src-deprecated to src/ directory
  • Adjusted file paths to reflect new location
src-deprecated/DiCompileModule.php
src/DiCompileModule.php
Apply PSalm-required class and method annotations
  • Marked DiCompileModule as final
  • Imported the Override attribute
  • Annotated configure() method with #[Override]
src/DiCompileModule.php

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 27, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Makes DiCompileModule final, adds #[Override] to its configure() method and imports Override; removes its deprecation docblock. Updates Scrutinizer CI config (build image, PHP 8.4, path filter, removes prior tools block). Changes GitHub workflow trigger to manual workflow_dispatch.

Changes

Cohort / File(s) Change Summary
Module finalization & attribute
src/DiCompileModule.php
Class changed to final; added use Override;; applied #[Override] to protected function configure(): void; removed deprecation docblock.
CI / Scrutinizer config
.scrutinizer.yml
Added build section (image default-jammy, PHP 8.4, nested analysis/tests override); added filter for paths: ["src/*"]; removed previous tools block and related analyzers.
GitHub workflow trigger
.github/workflows/claude-code-review.yml
Changed workflow trigger from pull_request to workflow_dispatch (manual run).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify #[Override] matches the parent AbstractModule::configure() signature and available attribute import resolution.
  • Ensure finalizing DiCompileModule does not break any subclass usage elsewhere.
  • Confirm Scrutinizer changes retain required analysis behavior and that removing the tools block is intentional.
  • Check workflow trigger change aligns with CI expectations.

Possibly related PRs

Suggested reviewers

  • NaokiTsuchiya

Poem

🐰 I hopped through code to make it neat,
Final stamped and Override complete.
CI trimmed to paths that matter,
A little carrot, then a scatter —
Hooray for tidy, tiny feats! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Move DiCompileModule from src-deprecated to src" directly captures the main structural change in the pull request. The changeset shows updates to DiCompileModule in src/ (making it final, adding the #[Override] attribute) and configuration changes in .scrutinizer.yml to filter paths accordingly. The title accurately describes the primary action being taken—promoting DiCompileModule from the deprecated directory to the active source directory. It is clear, concise, and specific enough that a teammate scanning the git history would immediately understand the key change: DiCompileModule is no longer deprecated and has been integrated into the main codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

📜 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 892531e and 4f78377.

📒 Files selected for processing (1)
  • .github/workflows/claude-code-review.yml (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.

@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c265c66) to head (4f78377).
⚠️ Report is 5 commits behind head on 1.x.

Additional details and impacted files
@@             Coverage Diff             @@
##                 1.x      #122   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       130       133    +3     
===========================================
  Files             13        14    +1     
  Lines            282       288    +6     
===========================================
+ Hits             282       288    +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c265c66 and 6ad5546.

📒 Files selected for processing (1)
  • src/DiCompileModule.php (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.php

📄 CodeRabbit inference engine (CLAUDE.md)

Code must support PHP 7.2+ or 8.0+; usage of PHP 8 attributes (#[...]) should remain compatible with supported versions

Files:

  • src/DiCompileModule.php
🧬 Code graph analysis (1)
src/DiCompileModule.php (2)
src/AbstractInjectorContext.php (1)
  • Override (30-31)
src/InjectionPoint.php (4)
  • Override (48-52)
  • Override (57-67)
  • Override (72-79)
  • Override (88-92)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: ci / PHPUnit - PHP 8.5 (windows-latest, highest)
  • GitHub Check: Sourcery review
🔇 Additional comments (2)
src/DiCompileModule.php (2)

26-30: Correct usage of #[Override] attribute.

The #[Override] attribute is semantically correct here, as configure() does override AbstractModule::configure(). The method implementation correctly binds the $doCompile boolean value to the @Compile annotation.


11-11: No breaking change concern identified in the codebase.

All usages of DiCompileModule follow composition patterns (instantiation, install(), override()), never inheritance. No code in tests, examples, or production extends this class. The final modifier aligns with the intended design.

@koriym koriym merged commit fd42f9d into 1.x Oct 27, 2025
53 of 54 checks passed
@koriym koriym deleted the remove-deprecated-annotation branch October 27, 2025 04:58
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.

1 participant

Comments