website/errors/new.deprecatedClass.md
<?php declare(strict_types = 1);
/** @deprecated Use NewLogger instead */
class OldLogger
{
}
new OldLogger();
This error is reported by the phpstan-deprecation-rules extension.
A deprecated class is being instantiated with new. The class has been marked with @deprecated, indicating it should no longer be used and may be removed in a future version.
Replace the deprecated class with the recommended replacement:
-new OldLogger();
+new NewLogger();
If the calling code is itself deprecated, the error will not be reported. Mark the calling class or function as deprecated if it is part of a deprecation migration:
+/** @deprecated */
function createLogger(): object
{
return new OldLogger();
}