NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist, #726 most downloaded on Packagist
Better Reflection - an improved code reflection API
Latest stable
6.75.0
Last release 28 days ago
17 Oct 2026
Ships fairly regularly
a new release about every 5 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
129 releases · first in 2015
Drag across the ruler to compare, or tap a release to open it.
This release improves the performance and reliability of the library, which is now fully working with PHP 7.2 and newer nikic/php-parser releases.
This release improves the performance and reliability of the library, which is now
fully working with PHP 7.2 and newer nikic/php-parser releases.
Some BC breaks had to be performed:
ReflectionException when a property is not found thanks to @muglugReflectionClass#getProperty() throw an exception when a property doesn't exist thanks to @kukulichReflectionType API so that a target reflection class can directly be retrieved, removed existing named constructor thanks to @OcramiusTotal issues resolved: 23
$myMethod to $myParameter as expected by getParameter('myParameter') thanks to @tobemediaReflectionException when a property is not found thanks to @muglugReflectionClass#getProperty() throw an exception when a property doesn't exist thanks to @kukulichdoctrine/coding-standard 2.0 thanks to @kukulichdoctrine/coding-standard 2.1 thanks to @kukulichfinal keyword from the private method ReflectionFunctionAbstract#loadStaticParser() thanks to @ntzmnikic/PHP-Parser 4.x thanks to @kukulichReflectionClass#isInstantiable() should report false for private constructors thanks to @UFOMelkorReflectionClass::isInstantiable() now reports false in case of inaccessible constructors thanks to @kukulichReflectionType API so that a target reflection class can directly be retrieved, removed existing named constructor thanks to @Ocramiusdoctrine/coding-standard 4.0 thanks to @kukulichext/date-time upgrades in PHP 7.2 thanks to @kukulichvimeo/psalm to the build and fixed detected static analysis issues that were detected by it thanks to @muglugYour coding agent can read these notes before it upgrades. Set up the MCP server →
398: Trait method aliases thanks to @lookyman
Total issues resolved: 2
This release fixes constraint incompatibilities with PHP 7.1.0, newer PHP 7.1.11 UConverter API and a type error raised when attempting to fetch the A
This release fixes constraint incompatibilities with PHP 7.1.0, newer PHP 7.1.11 UConverter API
and a type error raised when attempting to fetch the AST nodes of an interface's method.
Total issues resolved: 5
UConverter#getAliases($name) is not an optional parameter anymore as per latest PHP releases thanks to @Ocramius293: getDefaultValueAsString removals/deprecation thanks to @asgrim
This major release is a massive rework of the internal implementation details of BetterReflection.
Version 2.0.0 provides a massive performance boost when using the
new Roave\BetterReflection\BetterReflection kernel as an entry point
for using the library.
The minimum supported PHP version is now 7.1.0, which allows for
a much cleaner API definition: we added nullable hints to our own
API wherever applicable.
The compatibility with the ext-reflection
API is also almost complete, excluding some scenarios that would
forcefully require class autoloading.
Among the many new implemented features, we now support:
iterable type declarationsobject type declarationsconst visibility supportMost of the generally used API was not touched, but a lot of internal components were completely rewritten to address design and performance issues. Please make sure that you read the upgrade notes.
Total issues resolved: 138
__toString() functionality internally thanks to @asgrimClosureSourceLocator#locateIdentifiersByType() - investigate implementation thanks to @asgrimphpdocumentor/reflection-docblock 3.1 thanks to @asgrimLocatedSource#__construct() should accept empty string as $source thanks to @asgrimself thanks to @malukenhoself and parent hinted ReflectionParameter class reference thanks to @malukenhoiterable type thanks to @OcramiusReflectionType#__toString() should NOT prepend backslashes to class/interface types thanks to @OcramiusReflectionType (string) cast should not prepend backslash to class and interface types thanks to @Ocramius__DIR__ thanks to @TomasVotrubaobject hint thanks to @Ocramius__CLASS__ magic const thanks to @vlastaveselygetReturnType functionality to adapters thanks to @kukulichPhpParser\ParserFactory with PREFER_PHP7 parser everywhere thanks to @kukulichdeclare(strict_types=1) everywhere thanks to @kukulich\ (FQN) thanks to @kukulichReflectionClass#newInstance() on PHP 7.1 vs PHP 7.2 thanks to @OcramiusThrowable thanks to @OcramiusgetStartColumn() and getEndColumn() methods thanks to @kukulichPhpParser\NodeVisitor\NameResolver to simplify code thanks to @kukulichAnonymousClassObjectSourceLocator thanks to @kukulichPhpParser\BuilderFactory instead of Zend\Code\Generator\ClassGenerator in the SourceStubber thanks to @kukulichReflectionClass#getExtensionName() thanks to @kukulichassertObject return type with object, removing therefore the implicit upcast thanks to @Ocramius*::createFromNode methods as @internal thanks to @asgrimphpdocumentor/reflection-docblock dependency version thanks to @Ocramius*::createFromNode methods as @internal to indicate they… thanks to @marcomenzelClosure::fromCallable() to stubs thanks to @kukulichPhpInternalSourceLocator test and Closure stub thanks to @kukulichSlevomatCodingStandard.ControlStructures.RequireYodaComparison thanks to @kukulichReflectionParameter::getAst() thanks to @kukulichThis release introduces two new source locator classes, which are very helpful if you analyze directory trees that are not controlled by your autoload
This release introduces two new source locator classes, which are very helpful if you analyze directory trees that are not controlled by your autoloader:
BetterReflection\SourceLocator\Type\FileIteratorSourceLocator, which, given
an iterator of .php files, will be able to find classes, functions, and so
on in that set.BetterReflection\SourceLocator\Type\DirectoriesSourceLocator, which, given
a set of directories, will allow reflecting .php files in those directories.Total issues resolved: 1
Ability to modify function, method and class structure (basic monkey patching)
Summary of new features:
FindReflectionOnLine helper (look up code unit by filename and line number)Total issues resolved: 39
void return type for PHP 7.1166: Fix locateIdentifiersByType to correctly aggregate source
Total issues resolved: 1
37: Add ability to create a ReflectionFunction from a closure
Total issues resolved: 19
3: Refactored entire Reflector to be more flexible
Total issues resolved: 107
ReflectionClass#getMethods() returns methods defined in the current source only (and not all scope visible/inherited methods)ReflectionFunctionAbstract#$node type is too genericPhpInternalSourceLocator and EvaledCodeSourceLocator can only stub classesOne column per quarter.