ReflectionClass
class ReflectionClass implements Reflector (View source)
Constants
IS_IMPLICIT_ABSTRACT |
Indicates class that is abstract because it has some abstract methods. |
IS_EXPLICIT_ABSTRACT |
Indicates class that is abstract because of its definition. |
IS_FINAL |
Indicates final class. |
IS_READONLY
Since: 8.2
|
|
SKIP_INITIALIZATION_ON_SERIALIZE
Since: 8.4
|
|
SKIP_DESTRUCTOR
Since: 8.4
|
|
Properties
T> | $name |
Methods
Constructs a ReflectionClass
Exports a reflected class
Returns the string representation of the ReflectionClass object.
Gets class name
Checks if class is defined internally by an extension, or the core
Checks if user defined
Checks if the class is instantiable
Returns whether this class is cloneable
Gets the filename of the file in which the class has been defined
Gets starting line number
Gets end line
Gets doc comments
Gets the constructor of the class
Checks if method is defined
Gets a ReflectionMethod for a class method.
Gets an array of methods for the class.
Checks if property is defined
Gets a ReflectionProperty for a class's property
Gets properties
Gets a ReflectionClassConstant for a class's property
Gets class constants
Checks if constant is defined
Gets constants
Gets defined constant
Gets the interfaces
Gets the interface names
Checks if the class is anonymous
Checks if the class is an interface
Returns an array of traits used by this class
Returns an array of names of traits used by this class
Returns an array of trait aliases
Returns whether this is a trait
Checks if class is abstract
Checks if class is final
No description
Gets modifiers
Checks class for instance
Creates a new class instance from given arguments.
Creates a new class instance without invoking the constructor.
Creates a new class instance from given arguments.
Gets parent class
Gets static properties
Gets static property value
Sets static property value
Gets default properties
An alias of {ReflectionClass method.
Check whether this class is iterable
Checks whether it implements an interface.
Gets a ReflectionExtension object for the extension which defined the class
Gets the name of the extension which defined the class
Checks if in namespace
Gets namespace name
Gets short name
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Details
__construct(T>|T $objectOrClass)
Constructs a ReflectionClass
static string|null
export(mixed $argument, bool $return = false)
Exports a reflected class
string
__toString()
Returns the string representation of the ReflectionClass object.
string
getName()
Gets class name
bool
isInternal()
Checks if class is defined internally by an extension, or the core
bool
isUserDefined()
Checks if user defined
bool
isInstantiable()
Checks if the class is instantiable
bool
isCloneable()
Returns whether this class is cloneable
string|false
getFileName()
Gets the filename of the file in which the class has been defined
int|false
getStartLine()
Gets starting line number
int|false
getEndLine()
Gets end line
string|false
getDocComment()
Gets doc comments
ReflectionMethod|null
getConstructor()
Gets the constructor of the class
bool
hasMethod(string $name)
Checks if method is defined
ReflectionMethod
getMethod(string $name)
Gets a ReflectionMethod for a class method.
array
getMethods(int|null $filter = null)
Gets an array of methods for the class.
bool
hasProperty(string $name)
Checks if property is defined
ReflectionProperty
getProperty(string $name)
Gets a ReflectionProperty for a class's property
array
getProperties(int|null $filter = null)
Gets properties
ReflectionClassConstant|false
getReflectionConstant(string $name)
Gets a ReflectionClassConstant for a class's property
array
getReflectionConstants(int|null $filter = null)
Gets class constants
bool
hasConstant(string $name)
Checks if constant is defined
array
getConstants(int|null $filter = null)
Gets constants
mixed
getConstant(string $name)
Gets defined constant
array
getInterfaces()
Gets the interfaces
array
getInterfaceNames()
Gets the interface names
bool
isAnonymous()
Checks if the class is anonymous
bool
isInterface()
Checks if the class is an interface
array
getTraits()
Returns an array of traits used by this class
array
getTraitNames()
Returns an array of names of traits used by this class
array
getTraitAliases()
Returns an array of trait aliases
bool
isTrait()
Returns whether this is a trait
bool
isAbstract()
Checks if class is abstract
bool
isFinal()
Checks if class is final
bool
isReadOnly()
No description
int
getModifiers()
Gets modifiers
bool
isInstance(object $object)
Checks class for instance
T
newInstance(mixed ...$args)
Creates a new class instance from given arguments.
object
newInstanceWithoutConstructor()
Creates a new class instance without invoking the constructor.
object|null
newInstanceArgs(array $args = [])
Creates a new class instance from given arguments.
ReflectionClass|false
getParentClass()
Gets parent class
bool
isSubclassOf(string|ReflectionClass $class)
Checks if a subclass
array|null
getStaticProperties()
Gets static properties
mixed
getStaticPropertyValue(string $name, mixed $default)
Gets static property value
void
setStaticPropertyValue(string $name, mixed $value)
Sets static property value
array
getDefaultProperties()
Gets default properties
bool
isIterateable()
An alias of {ReflectionClass method.
bool
isIterable()
Check whether this class is iterable
bool
implementsInterface(string $interface)
Checks whether it implements an interface.
ReflectionExtension|null
getExtension()
Gets a ReflectionExtension object for the extension which defined the class
string|false
getExtensionName()
Gets the name of the extension which defined the class
bool
inNamespace()
Checks if in namespace
string
getNamespaceName()
Gets namespace name
string
getShortName()
Gets short name
array
getAttributes(string|null $name = null, int $flags = 0)
No description
bool
isEnum()
No description
object
newLazyGhost(callable $initializer, int $options = 0)
No description
object
newLazyProxy(callable $factory, int $options = 0)
No description
void
resetAsLazyGhost(object $object, callable $initializer, int $options = 0)
No description
void
resetAsLazyProxy(object $object, callable $factory, int $options = 0)
No description
object
initializeLazyObject(object $object)
No description
bool
isUninitializedLazyObject(object $object)
No description
object
markLazyObjectAsInitialized(object $object)
No description
callable|null
getLazyInitializer(object $object)
No description