PHP 8.1.15 Released!

ReflectionClass::isReadOnly

(PHP 8 >= 8.2.0)

ReflectionClass::isReadOnlyChecks if class is readonly

Descrição

public ReflectionClass::isReadOnly(): bool

Checks if a class is readonly.

Parâmetros

Esta função não possui parâmetros.

Valor Retornado

true if a class is readonly, false otherwise.

Exemplos

Exemplo #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());

?>

O exemplo acima irá imprimir:

bool(false)
bool(true)

Veja Também

add a note

User Contributed Notes

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