Refactor DI passes to reduce code duplication and improve consistency#28
Closed
Refactor DI passes to reduce code duplication and improve consistency#28
Conversation
- BuilderMan: Extract getValidatedFailureTransports() to eliminate duplicated validation in getTransportToFailureTransportsServiceMapping() and getFailedTransports() - EventPass: Consolidate 5 worker limit if-blocks into data-driven loop; simplify dispatcher registration with ternary - TransportPass: Reuse $transportDef instead of re-fetching same definition - ConsolePass: Use inherited $this->prefix() and $this->getContainerBuilder() consistently https://claude.ai/code/session_01RpDZTC6P3Lh78s4YbDZR2j
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #28 +/- ##
==========================================
+ Coverage 95.83% 95.86% +0.03%
==========================================
Files 25 25
Lines 648 629 -19
==========================================
- Hits 621 603 -18
+ Misses 27 26 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR refactors the DI (Dependency Injection) passes to eliminate code duplication, improve maintainability, and enhance consistency across the codebase. The changes focus on extracting repeated logic into reusable methods and simplifying conditional structures.
Key Changes
EventPass.php:
BuilderMan.php:
getValidatedFailureTransports()getTransportToFailureTransportsServiceMapping()andgetFailedTransports()methods to reuse the extracted validation logic, eliminating duplicate code and reducing maintenance burdenConsolePass.php:
$this->extension->getContainerBuilder()with$this->getContainerBuilder()for consistency$this->extension->prefix()with$this->prefix()for consistencyTransportPass.php:
$transportDefinitionwas retrieved separately when$transportDefwas already available$transportDefdirectlyNotable Implementation Details
getValidatedFailureTransports()method returns a structured array containing both the failure transport name and service name, allowing both calling methods to extract their needed data without duplicating validation logichttps://claude.ai/code/session_01RpDZTC6P3Lh78s4YbDZR2j