ReflectionClass::isReadOnly

(PHP 8 >= 8.2.0)

ReflectionClass::isReadOnlyChecks if class is readonly

Description

public ReflectionClass::isReadOnly(): bool

Checks if a class is readonly.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

true if a class is readonly, false otherwise.

Exemples

Exemple #1 ReflectionClass::isReadOnly() example

<?php
class TestClass { }
readonly class
TestReadOnlyClass { }

$normalClass = new ReflectionClass('TestClass');
$readonlyClass = new ReflectionClass('TestReadOnlyClass');

var_dump($normalClass->isReadOnly());
var_dump($readonlyClass->isReadOnly());

?>

L'exemple ci-dessus va afficher :

bool(false)
bool(true)

Voir aussi

add a note add a note

User Contributed Notes

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