2.0.0
This major release is a massive rework of the internal implementation details
of BetterReflection.
Improvements
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:
- Property/Method accessors
- Start/End line analysis for defined symbols
- PHP 7.1 nullable types
- PHP 7.1
iterable
type declarations - PHP 7.2
object
type declarations - PHP 7.1
const
visibility support - Monkey-patching classes on the fly via hijacked autoloader
- Immediate/inherited constants/methods/properties lookup
- PHP 4.x constructor detection
- Constant expression value resolution
- Closure reflection
- Anonymous class reflection
- Internal class parameter default value reflection (through stubs)
- Retrieving AST nodes for each reflection
BC Breaks
Most 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
- 14: Implement accessors without instantiating thanks to @asgrim
- 20: Validate identifier name in Identifier value object thanks to @asgrim
- 68: Add getColumn everywhere to complement getStartLine/getEndLine thanks to @asgrim
- 94: Improve
__toString()
functionality internally thanks to @asgrim - 98: Find a way to decrease complexity of compileBinaryOperator method thanks to @asgrim
- 103: ReflectionClass getMethods() and getProperties() do not filter thanks to @asgrim
- 131: Make Better Reflection faster thanks to @asgrim
- 152:
ClosureSourceLocator#locateIdentifiersByType()
- investigate implementation thanks to @asgrim - 169: Investigate upgrading to
phpdocumentor/reflection-docblock 3.1
thanks to @asgrim - 202: Review PHP 7.1 feature: nullable types thanks to @asgrim
- 204: Review PHP 7.1 feature: Class constant visibility modifiers thanks to @asgrim
- 205: Autoload interruption for dynamic monkey patching thanks to @asgrim
- 216: Autoload interruption for monkey patching thanks to @asgrim
- 217: Update our code for API changes in PHP-Parser thanks to @asgrim
- 218: Upgrade phpdocumentor reflection docblock thanks to @asgrim
- 219: Check compatibility with PHP 7.2 thanks to @asgrim
- 220: Fixed issues found by static analysis thanks to @ondrejmirtes
- 221: Upgrade minimum version to PHP 7.0 thanks to @asgrim
- 223: Add vendor prefix to namespaces thanks to @asgrim
- 225: Fixed function reflector doc thanks to @dantleech
- 226: Require minimum of PHP 7, enabling tests on PHP 7.1 thanks to @asgrim
- 227: Prefix namespaces with Roave thanks to @asgrim
- 228: Implement internal parsing of closures thanks to @asgrim
- 229: getDocBlockTypes() causes error when no docblock is present thanks to @dantleech
- 231: Inherited properties not returned by getProperties thanks to @dantleech
- 235:
LocatedSource#__construct()
should accept empty string as $source thanks to @asgrim - 236: Fix exception being thrown in AutoloadSourceLocator thanks to @asgrim
- 238: LocatedSource now allows empty strings as source code thanks to @asgrim
- 240: ReflectionParameter doesn't resolve parameter type
self
thanks to @malukenho - 241: Fix
self
andparent
hinted ReflectionParameter class reference thanks to @malukenho - 242: Support for the PHP 7.1
iterable
type thanks to @Ocramius - 243:
ReflectionType#__toString()
should NOT prepend backslashes to class/interface types thanks to @Ocramius - 244: Fix for #243:
ReflectionType
(string)
cast should not prepend backslash to class and interface types thanks to @Ocramius - 246: Fixed class constant value fetch when constant is declared in parent thanks to @janlanger
- 250: Types with no doc block thanks to @marcosh
- 251: Retrieve all functions in SourceLocator scope thanks to @marcosh
- 252: get all functions available in SourceLocator scope thanks to @marcosh
- 253: Usage: fix DirectoriesSourceLocator usage thanks to @TomasVotruba
- 254: README: drop unstable dependencies reference thanks to @TomasVotruba
- 255: create ReflectionParameter from closure thanks to @marcosh
- 256: create reflection parameter from closure thanks to @marcosh
- 257: Possible unused code path thanks to @asgrim
- 258: PHP 7.1 updates thanks to @asgrim
- 259: [Docs] Usage: drop SingleDirectorySourceLocator thanks to @TomasVotruba
- 260: [Docs] Usage - add FunctionReflector getAllFunctions() example thanks to @TomasVotruba
- 263: Support PHP4-style constructors? thanks to @asgrim
- 264: ReflectionMethod::isDestructor is case insensitive thanks to @asgrim
- 266: get file name of unlocated source could be null thanks to @marcosh
- 267: Testing that class constant visibility works thanks to @asgrim
- 268: Ensure locateFunctionByName returns ?string always thanks to @asgrim
- 269: Added case insensitivity to isConstructor and isDestructor methods thanks to @asgrim
- 271: getProperties returns inherited properties thanks to @marcosh
- 272: Added test cases for ?nullable and iterable types in PHP 7.1 thanks to @asgrim
- 273: [docs] example2.php - flip fallen space from the bottom thanks to @TomasVotruba
- 274: [failing-test] Namespaced Trait fails to be resolved thanks to @TomasVotruba
- 275: Filter get methods and properties thanks to @marcosh
- 277: [demo] add getAllClasses() examples, ref #276 thanks to @TomasVotruba
- 278: object immediate properties includes runtime properties thanks to @marcosh
- 279: Reflect on instances of anonymous classes thanks to @marcosh
- 280: [NodeCompiler] add support for
__DIR__
thanks to @TomasVotruba - 281: [PHP7.1] ::getReflectionConstant() and ::getReflectionConstants() support thanks to @POPSuL
- 282: [PHP 7.1] Add support for ReflectionClassConstant (#281) thanks to @POPSuL
- 284: fixed improper docblock retrieval thanks to @vlastavesely
- 285: FindReflectionOnLine cannot be configured to load dependencies thanks to @moufmouf
- 286: Make FindReflectionOnline more configurable thanks to @moufmouf
- 287: Remove namespace BC shim thanks to @asgrim
- 288: added ReflectionProperty::getDefaultValueAsString() thanks to @vlastavesely
- 290: Documentation fix regarding new Roave namespace thanks to @moufmouf
- 291: Added support for getStart/EndLine() for ReflectionClassConstant and ReflectionProperty thanks to @POPSuL
- 293: getDefaultValueAsString removals/deprecation thanks to @asgrim
- 294: Support for PHP 7.2's
object
hint thanks to @Ocramius - 296: ReflectionParameter::parseDefaultValueNode() - case insensitive check of TRUE, FALSE and NULL thanks to @vlastavesely
- 297: ReflectionParameter: return full name if default value is class' constant thanks to @vlastavesely
- 298: CompileNodeToValue: added support for
__CLASS__
magic const thanks to @vlastavesely - 300: Support for anonymous classes thanks to @kukulich
- 301: Fixed travis.yml - no PHP 7.0 support already thanks to @kukulich
- 302: ReflectionClass::getConstants() and ::getReflectionConstants() should return inherited constants thanks to @kukulich
- 303: Added missing
getReturnType
functionality to adapters thanks to @kukulich - 304: Adapters API is not consistent with internal reflection thanks to @kukulich
- 305: Fixed almost all tests on Windows thanks to @kukulich
- 306: Adding appveyor config to test on windows thanks to @Ocramius
- 307: Removed dead code that skipped tests for older PHP versions thanks to @kukulich
- 308: Improve AppVeyor build setup to include more extensions thanks to @kukulich
- 309: Use
PhpParser\ParserFactory
withPREFER_PHP7
parser everywhere thanks to @kukulich - 311:
declare(strict_types=1)
everywhere thanks to @kukulich - 313: Adapters are more compatible with internal reflections thanks to @kukulich
- 314: Internal functions are to be used with
\
(FQN) thanks to @kukulich - 315: Adding type hints to closures thanks to @kukulich
- 316: PHPStan integration (Level 5 with exclusions) and CI stages thanks to @Ocramius
- 317: Incompatibility between
ReflectionClass#newInstance()
on PHP 7.1 vs PHP 7.2 thanks to @Ocramius - 318: #317 locking onto PHP 7.1 due to reflection API changes that cannot be made compatible with both versions thanks to @Ocramius
- 319: Remowing workarounds used in pre-php-7 code to catch any exception that isn't a
Throwable
thanks to @Ocramius - 320: Support for PHP4 style constructors thanks to @kukulich
- 321: ClosureSourceLocator improvements thanks to @kukulich
- 322: Implemented
getStartColumn()
andgetEndColumn()
methods thanks to @kukulich - 323: Method isSubclassOf() of ReflectionClass adapter should check also implemented interfaces to be compatible with internal reflection thanks to @kukulich
- 324: Method getFileName() of adapters should return false where no filename to be compatible with internal reflection thanks to @kukulich
- 325: Class with name "Scalar" is not resolved right thanks to @kukulich
- 327: Property from Trait should have actual class as declaring class thanks to @kukulich
- 328: Coding standard thanks to @kukulich
- 329: More coding standard checks thanks to @kukulich
- 330: Adapters compatibility for properties and methods from traits thanks to @kukulich
- 331: Used
PhpParser\NodeVisitor\NameResolver
to simplify code thanks to @kukulich - 332: Added missing documentation of
AnonymousClassObjectSourceLocator
thanks to @kukulich - 333:
PhpParser\BuilderFactory
instead ofZend\Code\Generator\ClassGenerator
in theSourceStubber
thanks to @kukulich - 334: Update phpdocumentor/reflection-docblock thanks to @asgrim
- 335: Self and parent are not builtin types in internal reflection thanks to @kukulich
- 336: Fixes of bugs introduced in #331 thanks to @kukulich
- 337: BetterReflection entry-point class thanks to @Ocramius
- 338: Memoize parsing and symbol detection: improves performance by removing repeated I/O and parsing thanks to @Ocramius
- 340: Fixed AppVeyor badge thanks to @kukulich
- 341: Check if identifier name is valid thanks to @kukulich
- 342: ReflectionClass::newInstance() and ReflectionObject::newInstance() compatibility in all PHP versions thanks to @kukulich
- 343: Implemented ReflectionProperty::setAccessible(), getValue() and setValue() and ReflectionClass::getStaticProperties() thanks to @kukulich
- 344: Fixed stubs searching thanks to @kukulich
- 345: Introduced PHPBench with sample benchmark thanks to @dantleech
- 346: Avoid repeated source parsing when trying to analyse docblock types thanks to @Ocramius
- 347: FindTypeFromAst dropped in #331 with no upgrade path thanks to @asgrim
- 348: Migrate BC Breaks documentation to migration path docs thanks to @Ocramius
- 349: Improved SourceStubber trait tests thanks to @kukulich
- 350: Implement
ReflectionClass#getExtensionName()
thanks to @kukulich - 351: ReflectionClass::implementsInterface() stopped working thanks to @TomasVotruba
- 352: Cleanup: generic type/static analysis fixes thanks to @Ocramius
- 353: #351 verify stub implemented interfaces and extended classes thanks to @Ocramius
- 354: Implemented ReflectionMethod::getClosure() thanks to @kukulich
- 355: Implemented ReflectionMethod::invoke(), invokeArgs() and setAccessible() thanks to @kukulich
- 356: Replacing internal
assertObject
return type withobject
, removing therefore the implicit upcast thanks to @Ocramius - 357: Implemented missing functions in ReflectionFunction thanks to @kukulich
- 358: Mark
*::createFromNode
methods as@internal
thanks to @asgrim - 359: #334 bump
phpdocumentor/reflection-docblock
dependency version thanks to @Ocramius - 360: Mark
*::createFromNode
methods as@internal
to indicate they… thanks to @marcomenzel - 361: String casting improvements thanks to @kukulich
- 362: AppVeyor configuration tuning thanks to @kukulich
- 363: Fixed infinite recursion in CompileNodeToValue thanks to @kukulich
- 364: Not all constants defined with const keyword are detected thanks to @kukulich
- 366: Fixed detection of all constants and properties defined by one keyword thanks to @kukulich
- 367: Added
Closure::fromCallable()
to stubs thanks to @kukulich - 368: Improved
PhpInternalSourceLocator
test andClosure
stub thanks to @kukulich - 369: Added
SlevomatCodingStandard.ControlStructures.RequireYodaComparison
thanks to @kukulich - 370: Added
ReflectionParameter::getAst()
thanks to @kukulich