Download the PHP package xp-framework/reflection without Composer
On this page you can find all versions of the php package xp-framework/reflection. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xp-framework/reflection
More information about xp-framework/reflection
Files in xp-framework/reflection
Package reflection
Short Description Reflection
License BSD-3-Clause
Homepage http://xp-framework.net/
Informations about the package reflection
XP Reflection
This library provides a replacement for the XP Framework's reflection API.
Features
Concise: This library aims at reducing code noise of the form if (hasX(...)) { getX() }
by simply returning NULL from its accessor methods. Null handling has improved with the introduction of the null-coalesce operator ??
in PHP 7 and the null-safe invocation operator ?->
in PHP 8 (and in XP Compiler).
PHP 7 & 8: This library handles PHP 8 attributes in both PHP 7 (using the compiler's AST library) and PHP 8 (using its native reflection API).
Subcommand: This library provides an RFC #0303 integration and offers a "reflect" subcommand for the new XP runners. See xp help reflect
on how to use it.
API
The entry point class is the lang.Reflection
class. It can be constructed by passing either objects, type literals (e.g. Date::class
), fully qualified class names (e.g. util.Date
) or lang.XPClass
or PHP's ReflectionClass
instances.
Annotations can be accessed by iterating over annotations()
or by the shorthand method annotation()
.
The constructor can be accessed via constructor()
. Like members, it provides accessors for modifiers and annotations, as well as its declaring type.
Type instantiation can be controlled by using initializer()
. It accepts either closures or named references to instance methods.
All members (constants, properties and methods) can be accessed by iterating or by a shorthand lookup by name. Members provide accessors for modifiers and annotations, as well as their declaring type.
Method and constructor parameters can be retrieved by iterating via parameters()
, by offset parameter($position)
or by name parameter($name)
.
Packages can be reflected upon by passing namespace names to Reflection::of()
.
All versions of reflection with dependencies
xp-framework/ast Version ^11.0 | ^10.0 | ^9.0 | ^8.0 | ^7.6
php Version >=7.4.0