ReflectionClassConstant::isDeprecated

(PHP 8 >= 8.4.0)

ReflectionClassConstant::isDeprecatedChecks if deprecated

Beschreibung

public function ReflectionClassConstant::isDeprecated(): bool

Checks whether the class constant is deprecated.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

true if it's deprecated, otherwise false

Beispiele

Beispiel #1 ReflectionClassConstant::isDeprecated() example

<?php
class Basket {
    #[\Deprecated(message: 'use Basket::APPLE instead')]
    public const APLE = 'apple';

    public const APPLE = 'apple';
}
$classConstant = new ReflectionClassConstant('Basket', 'APLE');
var_dump($classConstant->isDeprecated());
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

bool(true)

Siehe auch

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top