Add support for "Roave/BetterReflection"
WalterWoshid opened this issue · comments
Repo: https://github.com/Roave/BetterReflection
My use case:
For my library https://github.com/okapi-web/php-aop I need to create copies of classes and modify them. But I am not allowed to autoload them, I have to reflect them by the file contents itself. I actually hacked it together myself, by adding the BetterReflection classes as a union type.
For example:
public function fromParameterReflection(\ReflectionParameter $from): Parameter
{...}
becomes
use Roave\BetterReflection\Reflection\ReflectionParameter as BetterReflectionParameter;
public function fromParameterReflection(\ReflectionParameter|BetterReflectionParameter $from): Parameter
{...}
From my experience the BetterReflection library has all the methods that the Base Reflection classes also have. And it will work, even if people don't have the BetterReflection library installed.
Why don't you use the built-in BetterReflection adapter?
@JanTvrdik Damn, I'm stupid. Thank you for the information!