Skip to content

Report deprecation when calling methods of a deprecated trait#191

Open
devfrey wants to merge 1 commit into
phpstan:2.0.xfrom
devfrey:deprecated-trait-methods
Open

Report deprecation when calling methods of a deprecated trait#191
devfrey wants to merge 1 commit into
phpstan:2.0.xfrom
devfrey:deprecated-trait-methods

Conversation

@devfrey
Copy link
Copy Markdown

@devfrey devfrey commented May 23, 2026

Closes #128

When a trait is marked @deprecated, calls to its methods are now reported as deprecation errors — for both instance and static calls.

Example:

/** @deprecated use something else */
trait MyTrait {
    public function doFoo() {}
}

class X {
    use MyTrait;
}

$x = new X();
$x->doFoo(); // Call to method doFoo() of deprecated trait MyTrait: use something else

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.

deprecated trait should turn all methods deprecated

1 participant