ReflectionClass::isAbstract

(PHP 5)

ReflectionClass::isAbstractChecks if class is abstract

Beskrivelse

public bool ReflectionClass::isAbstract ( void )

Checks if the class is abstract.

Parametre

This function has no parameters.

Returnerings Værdier

Returns TRUE on success or FALSE on failure.

Eksempler

Eksempel #1 ReflectionClass::isAbstract() example

<?php
class          TestClass { }
abstract class 
TestAbstractClass { }

$testClass     = new ReflectionClass('TestClass');
$abstractClass = new ReflectionClass('TestAbstractClass');

var_dump($testClass->isAbstract());
var_dump($abstractClass->isAbstract());
?>

The above example will output:

bool(false)
bool(true)

Se også

add a note add a note

User Contributed Notes 1 note

up
2
baptiste at pillot dot fr
7 years ago
For interfaces and traits :

<?php
interface TestInterface { }
trait    
TestTrait { }

$interfaceClass = new ReflectionClass('TestInterface');
$traitClass     = new ReflectionClass('TestTrait');

var_dump($interfaceClass->isAbstract());
var_dump($traitClass->isAbstract());
?>

Using PHP versions 5.4- to 5.6, the above example will output:

bool(false)
bool(true)

Using PHP versions 7.0+, the above example will output:

bool(false)
bool(false)
To Top