Skip to content

Add allowed targets to Attributes #5518

Closed

Description

@attrib

Affected page

https://www.php.net/manual/en/class.deprecated.php

Current issue

Its missing a information where this attribute can be used:

e.g. for Deprecated

PHP 8.4:

  • Method
  • Function
  • Class Constant
  • Constant

PHP 8.5:

Adds Traits (https://wiki.php.net/rfc/deprecated_traits) (but not Class!)

Similar issue for all other attributes:

Suggested improvement

At least add the information from the stub, e.g. #[Attribute(Attribute::TARGET_METHOD|Attribute::TARGET_FUNCTION|Attribute::TARGET_CLASS_CONSTANT|Attribute::TARGET_CONSTANT|Attribute::TARGET_CLASS)] to Class synopsis.

Not sure how to handle special cases like only traits in PHP 8.5 for Deprecated Attribute

Additional context (optional)

No response

Activity

  1. jordikroon commented on Jun 23, 2026

    @jordikroon
    Member

    A first attempt for this has been made in #5631 however first php/phd#256 needs to be merged.

  2. jordikroon commented on Sep 11, 2026

    @jordikroon
    Member

    Thank you for reporting. This has now been completed by #5631

    Aaand like your username. It matches the topic. Thank you, mr attrib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions