PHP 5.6.29 Released

ReflectionClass::isAbstract

(PHP 5, PHP 7)

ReflectionClass::isAbstractChecks if class is abstract

Descrição

public bool ReflectionClass::isAbstract ( void )

Checks if the class is abstract.

Parâmetros

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

Valor Retornado

Retorna TRUE em caso de sucesso ou FALSE em caso de falha.

Exemplos

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

O exemplo acima irá imprimir:

bool(false)
bool(true)

Veja Também

add a note add a note

User Contributed Notes 1 note

up
0
baptiste at pillot dot fr
1 month 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