Skip to content

Comments

feat: add deprecation tracking system#355

Open
Chemaclass wants to merge 4 commits intomainfrom
feat/deprecation-tracking
Open

feat: add deprecation tracking system#355
Chemaclass wants to merge 4 commits intomainfrom
feat/deprecation-tracking

Conversation

@Chemaclass
Copy link
Member

TL;DR

Introduces deprecation tracking infrastructure with #[Deprecated] attribute, DeprecationScanner for analyzing codebase, and list:deprecated command to help manage technical debt and provide clear migration paths.

Summary

  • #[Deprecated] attribute for marking deprecated classes, methods, and properties
  • Support for deprecation reasons and alternative suggestions
  • DeprecationScanner for automated codebase analysis
  • list:deprecated command to scan and report all deprecated code with locations
  • File location reporting for easy navigation to issues
  • Comprehensive test coverage

Key Features

Mark Deprecated Code:

use Gacela\Framework\Attribute\Deprecated;

#[Deprecated(reason: 'Use NewService instead', alternative: 'App\NewService')]
class OldService
{
    #[Deprecated(reason: 'Use processV2() instead')]
    public function process(): void
    {
        // old implementation
    }
}

Scan for Deprecated Usage:

vendor/bin/gacela list:deprecated

Output:

  • Lists all deprecated classes, methods, and properties
  • Shows deprecation reasons and alternatives
  • Reports file locations for each deprecated item
  • Helps teams plan migration strategies

Use Cases

  • Managing technical debt and planning refactoring
  • Providing clear migration paths for deprecated APIs
  • Automated scanning before major version releases
  • Documenting why code is deprecated and what to use instead
  • IDE integration for deprecation warnings

Introduce deprecation tracking infrastructure with attributes, scanning,
and reporting capabilities to help manage technical debt and migration
paths.

Key features:
- #[Deprecated] attribute for marking deprecated code with reasons
- Alternative suggestions to guide users to replacement code
- DeprecationScanner for analyzing codebase deprecated usage
- list:deprecated command to scan and report all deprecated code
- File location reporting for easy navigation to deprecated usage
- Full test coverage

This helps teams manage technical debt by clearly marking deprecated
code, providing migration guidance, and enabling automated scanning
to find all usages before removal.
- Add non-empty string checks before calling scanFile
- Simplify isset check for preg_match_all result
- Add assert for rootDir in ListDeprecatedCommand
- Regenerate Psalm baseline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant