PHP 8.4.2 Released!

ReflectionClass::isFinal

(PHP 5, PHP 7, PHP 8)

ReflectionClass::isFinalChecks if class is final

Description

public ReflectionClass::isFinal(): bool

Checks if a class is final.

Parameters

This function has no parameters.

Return Values

Returns true on success or false on failure.

Examples

Example #1 ReflectionClass::isFinal() example

<?php
class TestClass { }
final class
TestFinalClass { }

$normalClass = new ReflectionClass('TestClass');
$finalClass = new ReflectionClass('TestFinalClass');

var_dump($normalClass->isFinal());
var_dump($finalClass->isFinal());

?>

The above example will output:

bool(false)
bool(true)

See Also

add a note

User Contributed Notes

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