Quotidien Shaarli

Tous les liens d'un jour sur une page.

December 31, 2024

reflection/composer.json at main · web-fu/reflection · GitHub
thumbnail

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::getConstant return false if the constant does not exist or if the constant is equal to false.
  • ReflectionClass::newInstance return 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