pine3ree / pine3ree-reflection-helper
A basic reflection helper
0.5.0
2025-05-03 22:28 UTC
Requires
- php: ^7.4 || ^8.0
Requires (Dev)
- phpstan/phpstan: ^1.12 || ^2.0
- phpstan/phpstan-strict-rules: ^1.5
- phpunit/phpunit: ^9.3
- squizlabs/php_codesniffer: ^3.5
- webimpress/coding-standard: ^1.3
This package is auto-updated.
Last update: 2025-05-03 22:31:31 UTC
README
This package provides a simple helper that return reflection classes for given object/class/function and cache the results.
<?php use Closure; use ReflectionClass; use ReflectionFunction; use ReflectionMethod; use ReflectionParameter; use ReflectionProperty; use pine3ree\Helper\Reflection; Reflection::getClass(object|class-string $objectOrClass); // @return ReflectionClass|null Reflection::getProperties(object|class-string $objectOrClass); // @return array<string|ReflectionProperty>|null Reflection::getProperty(object|class-string $objectOrClass, string $name); // @return ReflectionProperty|null Reflection::getMethods(object|class-string $objectOrClass); // @return array<string|ReflectionMethod>|null Reflection::getMethod(object|class-string $objectOrClass, string $name); // @return ReflectionMethod|null Reflection::getConstructor(objectOrClass); // @return ReflectionMethod|null Reflection::getFunction(string $function); // @return ReflectionFunction|null Reflection::getParametersForMethod(object|class-string $objectOrClass, string $name, bool $check_existence = true); // @return array<int, ReflectionParameter>|null Reflection::getParametersForConstructor(object|class-string $objectOrClass, bool $check_existence = true); // @return ReflectionParameter[]|null Reflection::getParametersForInvokable(object $invokable); // @return ReflectionParameter[]|null Reflection::getParametersForFunction(string $function, bool $check_existence = true); // @return ReflectionParameter[]|null Reflection::clearCache(string $type = self::CACHE_ALL): void