Skip to content

Refactor generator command#700

Open
dvlpp wants to merge 6 commits intomainfrom
codex/refactor-generator-command
Open

Refactor generator command#700
dvlpp wants to merge 6 commits intomainfrom
codex/refactor-generator-command

Conversation

@dvlpp
Copy link
Member

@dvlpp dvlpp commented Feb 3, 2026

Summary: Add GeneratorFileEditor, centralize list/show class resolution, reduce duplication. Tests: composer test

@dvlpp dvlpp changed the title Refactor generator command helpers [code] Refactor generator command helpers Feb 3, 2026
@dvlpp dvlpp changed the title [code] Refactor generator command helpers [codex] Refactor generator command helpers Feb 3, 2026
@dvlpp dvlpp changed the title [codex] Refactor generator command helpers Refactor generator command Feb 4, 2026
@dvlpp dvlpp requested a review from Copilot February 4, 2026 09:01
Copy link
Contributor

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 pull request refactors the generator command to improve code organization and reduce duplication. The refactoring introduces a new GeneratorFileEditor utility class to centralize file editing operations, adds helper methods to resolve entity list and show classes, and replaces the switch statement with a more maintainable array-based approach. Additionally, it renames the test fixture from ClosedPeriod to UnitTestModel for better clarity and adds comprehensive tests for new generator features.

Changes:

  • Introduced GeneratorFileEditor utility class to centralize file modification operations
  • Added resolveEntityListClass() and resolveEntityShowClass() helper methods to eliminate duplicated class resolution logic
  • Refactored wizard type selection from switch statement to array-based handler mapping
  • Renamed test fixture from ClosedPeriod to UnitTestModel and added new test cases for commands, filters, entity states, and reorder handlers

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/Console/Utils/GeneratorFileEditor.php New utility class that encapsulates file editing operations for use statements, method arrays, and method chains
src/Console/GeneratorCommand.php Refactored to use GeneratorFileEditor, added class resolution helpers, improved provider validation with retry loop, replaced switch with array-based handlers
tests/Unit/Console/GeneratorTest.php Updated fixture references from ClosedPeriod to UnitTestModel, added 4 new comprehensive test cases
tests/Fixtures/UnitTestModel.php Renamed class from ClosedPeriod to UnitTestModel for clearer test semantics

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

dvlpp and others added 4 commits February 4, 2026 10:10
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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