1.2.344. Deprecated Attribute

The Deprecated attribute marks a class, method, property, class constants and functions that should not be used anymore. The element is still usable in the current version, and it might be removed in a future version.

The full description of the deprecation include #[Deprecated(reason: '', replacement: '')]. The reason parameter is a human readable reason for the change; the replacement parameter is a replacement suggestion. Only the attribute is used in this rule.

<?php

class x {
     #[Deprecated]
     function foo() {}
}

$x = new x;
$x->foo();

?>

See also #[Deprecated].

1.2.344.1. Connex PHP features

1.2.344.1.1. Suggestions

  • Replace this call to another call, that is future proof.

1.2.344.1.2. Specs

Short name

Attributes/Deprecated

Rulesets

All, Attributes, Changed Behavior

Exakat since

2.6.8

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Available in

Entreprise Edition, Exakat Cloud