feat: Add YagniPreset to detect and remove unused interfaces, abstract classes, and traits on scanned paths - #308
Draft
samsonasik wants to merge 10 commits into
Draft
feat: Add YagniPreset to detect and remove unused interfaces, abstract classes, and traits on scanned paths#308samsonasik wants to merge 10 commits into
samsonasik wants to merge 10 commits into
Conversation
…t classes, and traits on scanned paths
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
samsonasik
marked this pull request as draft
August 18, 2026 20:07
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.
This PR introduce new interfaces:
Boundwize\StructArmed\Rule\UsedInterfaceAwareRuleInterfaceBoundwize\StructArmed\Rule\UsedTraitAwareRuleInterfacethat used on new
YagniPresetin addition of existing:Boundwize\StructArmed\Rule\ExtendedClassAwareRuleInterfaceThe YagniPreset can do:
The rules for them is support
--fixso you can remove above violations and the file (if only consist of declarion).You can define
YAGNIpreset:<?php declare(strict_types=1); use Boundwize\StructArmed\Architecture; use Boundwize\StructArmed\Preset\Preset; use Boundwize\StructArmed\Preset\Presets\Psr1Preset; use Boundwize\StructArmed\Rule\Rules\Class_\MustBeFinalRule; return Architecture::define() // ... other config ... - ->withPresets(Preset::PSR1(), Preset::PSR12(), Preset::PSR4()); + ->withPresets(Preset::PSR1(), Preset::PSR12(), Preset::PSR4(), Preset::YAGNI());