Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

Replaces unstructured @deprecated DocBlocks with a type-safe PHP 8 attribute supporting GUID-based tracking and programmatic access via Reflection API.

Implementation

New Deprecated attribute (app/Attributes/Deprecated.php)

  • Required: guid (unique identifier, e.g., DEP-2026-001), message (deprecation reason)
  • Optional: since (version/date), alternative (replacement), removeIn (removal version)
  • Supports: classes, methods, properties, constants
  • Methods: getFormattedMessage(), toArray()

Usage example:

use App\Attributes\Deprecated;

#[Deprecated(
    guid: 'DEP-2026-001',
    message: 'Customers no longer identified by operator_level',
    since: 'v1.0.0 (2026-01-30)',
    alternative: 'is_subscriber flag',
    removeIn: 'v2.0.0'
)]
public const OPERATOR_LEVEL_CUSTOMER = 100;

Reflection API access:

$reflection = new ReflectionMethod(User::class, 'networkUser');
$attrs = $reflection->getAttributes(Deprecated::class);
$deprecated = $attrs[0]->newInstance();
echo $deprecated->getFormattedMessage();
// "DEPRECATED [DEP-2026-002] since v1.0.0 - Network credentials now stored directly on User model..."

Deliverables

  • Attribute class with 11 passing unit tests (36 assertions)
  • 383-line README: usage guide, GUID conventions, migration from @deprecated, Reflection examples
  • Updated DEPRECATED.md with v3.3 section and migration guide
  • Sample implementation in User model (2 deprecated elements)

Benefits

  • Structured data: Programmatically queryable vs free-form text
  • GUID tracking: Unique IDs for deprecation inventory and tooling
  • Type safety: Compile-time validation vs runtime parsing
  • Backwards compatible: Can coexist with @deprecated during transition
Original prompt

Generate doc and guid for Deprecated


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: lupael <43011721+lupael@users.noreply.github.com>
Copilot AI changed the title [WIP] Update documentation for deprecated features Add Deprecated attribute with GUID tracking and structured metadata Jan 31, 2026
Copilot AI requested a review from lupael January 31, 2026 17:05
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.

2 participants