2051 shaares
This library is a type safe wrapper for PHP Reflection API.
This library is born with the purpose to solve the problem of type safety in PHP Reflection API.
Reflection API is a very powerful tool, but presents some issues.
For example:
- the original
ReflectionClass::getConstantreturnfalseif the constant does not exist or if the constant is equal tofalse. ReflectionClass::newInstancereturn a generic object, but it is possible to know the type of the object.- New interfaces are added to the Reflection API in different PHP versions, so it is not possible to use them in a cross-version way.
Installation
web-fu/reflection is available on Packagist and can be installed
using Composer.
composer require web-fu/reflection