PHPackages                             phpactor/worse-reflection - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. phpactor/worse-reflection

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

phpactor/worse-reflection
=========================

Lazy AST reflector that is much worse than better

0.6.0(1y ago)21131.7k↓25.6%10[3 issues](https://github.com/phpactor/worse-reflection/issues)[2 PRs](https://github.com/phpactor/worse-reflection/pulls)10MITPHPPHP ^8.1

Since Feb 26Pushed 1y ago4 watchersCompare

[ Source](https://github.com/phpactor/worse-reflection)[ Packagist](https://packagist.org/packages/phpactor/worse-reflection)[ RSS](/packages/phpactor-worse-reflection/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (16)Versions (60)Used By (10)

Worse Reflection
================

[](#worse-reflection)

> This package is not actively developed here but in the main [phpactor](https://github.com/phpactor/phpactor) repository. It is *occasionally* updated. Raise any issues about this repository there.

This library aims to provide a light class-based AST based "reflection" library.

Worse than Better
-----------------

[](#worse-than-better)

It is influenced by [BetterReflection](https://github.com/Roave/BetterReflection), diffrerences are as follows:

- Can reflect variables.
- Does not aim to implement built-in PHP reflection API.
- Uses the amazing [Tolerant Parser](https://github.com/Microsoft/tolerant-php-parser).
- Uses the PHPStorm stubs to provide reflections of internal classes.

It is being developed to provide support for the [Phpactor](https://github.com/dantleech/phpactor) introspection and refactoring tool. And is therefore driven by that use case.

If you want comprehsnsive reflection, use BetterReflection. If you want faster reflection including type/value flow with no support and frequent BC breaks, then you can use this one (note that I havn't benchmarked BR in sometime, it may well be faster now).

Usage
-----

[](#usage)

```
$reflector = ReflectorBuilder::create()
    ->addSource('
