Skip to content

MIR1007

DeprecatedTrait

A trait annotated with @deprecated is being used via a use statement. Deprecated traits are scheduled for removal and should not be used in new code.

<?php
/**
* @deprecated Use the new LoggingTrait instead.
*/
trait OldLoggingTrait {
public function log(string $msg): void {}
}
class MyClass {
use OldLoggingTrait; // uses deprecated trait
}

Replace the deprecated trait with its documented successor.