mirko-pagliai/reflection

This package is abandoned and no longer maintained. The author suggests using the mirko-pagliai/php-tools package instead.

A trait for Reflection

1.0.3 2018-01-30 13:42 UTC

This package is not auto-updated.

Last update: 2022-02-01 13:03:43 UTC


README

Starting April 2018 and 1.0.3 version, this repository has been abandoned.
See instead: mirko-pagliai/php-tools.

Reflection

Software License Build Status Coverage Status

This package contains the ReflectionTrait, a trait that works as a wrapper for the Reflection classes provided by PHP, and allows you to easily:

  • invoke protected or private methods;
  • set/get protected or private properties.

This trait comes to test protected and private methods and properties with PHPUnit.

See tests for examples.
In the code we can access (and test) faster to the protected and private methods and properties that are declared in the Example class.

Available methods are:

invokeMethod(&$object, $methodName, array $parameters = [])

getProperty(&$object, $propertyName)

setProperty(&$object, $propertyName, $propertyValue)

Versioning

For transparency and insight into our release cycle and to maintain backward compatibility, Reflection will be maintained under the Semantic Versioning guidelines.