Skip to content

Support for defining hook methods with both attribute and annotation without getting a deprecation #5695

@stof

Description

@stof

For packages wanting to support multiple major versions of PHPUnit (from 9 to latest in the case of prophecy-phpunit), it would be great to be able to define hook methods in a way supported in all versions without getting deprecations. See phpspec/prophecy-phpunit#60 for the discussion.

My suggestion would be supporting to define both the attribute and the annotation on the test method. Such cases should ignore the annotation entirely (making the corresponding attribute provide the configuration) without reporting a deprecation in PHPUnit 11 about the annotation being deprecated.
What do you think about this proposal ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementA new idea that should be implemented

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions