Releases: Roave/BetterReflection
2.0.1
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
- 372: Added missing parent::setUp() in tests thanks to @kukulich
- 376: Incorrect PHP version constraint thanks to @nikic
- 377: composer: allow PHP 7.1 thanks to @TomasVotruba
- 379: Return empty ast for interface method body thanks to @codeliner
- 380: #379
UConverter#getAliases($name)
is not an optional parameter anymore as per latest PHP releases thanks to @Ocramius
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...
1.2.0
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
1.1.0
Summary of new features:
- Ability to modify function, method and class structure (basic monkey patching)
- Ability to replace the body of a function or method
- Updated documentation
- PHP 7 compatibility
- Some PHP 7.1 compatibility (more features will come in a future version!)
- Implemented ::class constant resolution
FindReflectionOnLine
helper (look up code unit by filename and line number)- Various other improvements and bugfixes
Total issues resolved: 39
- 35: Investigate PHP 7 compatibility
- 134: Add methods to modify reflections
- 141: Method body replacement
- 155: Write .phpt test suite
- 161: Review & improve documentation
- 162: Ability to add/remove type declarations and return type declarations
- 164: Support parameter type and return type declarations in PHP 7
- 165: Fix coding standards with fix-cs.sh script
- 168: Implemented ::class constant resolution
- 171: Update dependencies
- 174: Correct use statements in documentation
- 175: Drastically improved quality of library
- 176: PHP 7 types support
- 177: Docs and phpdoc fixes for PHP 7 types
- 178: Look up code unit by filename and line number
- 180: Set/remove PHP 7 types
- 181: Added FindReflectionOnLine helper utility
- 183: Fixed broken monkey patching example
- 184: Add demo tests to Travis build
- 185: Use prefer-dist in travis now (see composer/composer#4884)
- 187: ReflectionClass modifications
- 188: New phpt suite
- 189: Call to a member function isInterface() on null
- 190: ReflectionClass expected, null given
- 191: Call to a member function getInterfacesHierarchy() on null
- 192: Need to report which files are unparseable.
- 193: Throw exceptions when ClassReflector cannot locate identifiers
- 194: Rethrow any exception encountered whilst finding reflections
- 195: Any way to get fully qualified class names in AST
- 196: Added addParameter and removeParameter methods
- 197: Added ReflectionProperty::setVisibility method
- 198: Add ReflectionFunctionAbstract->getReturnStatementAst()
- 199: Fix unit test broken by PhpParser 2.1.0 change
- 203: Review PHP 7.1 feature: void return type
- 206: Added ReflectionFunctionAbstract::getReturnStatementsAst() method
- 207: Updates to documentation from BR presentation at DPC
- 208: Replaced fabpot/php-cs-fixer with friendsofphp/php-cs-fixer
- 209: Added test for
void
return type for PHP 7.1 - 210: Fixed docblock for AbstractSourceLocator
1.0.1
Total issues resolved: 1
1.0.0
Total issues resolved: 19
- 37: Add ability to create a ReflectionFunction from a closure
- 61: Reflection* classes should be uncloneable
- 87: Cannot determine default value for internal classes
- 101: #87 Loads of stubs
- 109: Variadic arguments are always optional
- 114: Implement [g|s\etStaticPropertyValue in ReflectionClass
- 130: Fetch AST or Code for a method/function
- 133: Allow exporting a reflection to PHP
- 135: Add returning AST methods
- 145: Ability to create non-class/function reflections by Name
- 147: Added demo folder
- 149: Use branch-alias instead of dev-master
- 150: Make reflections uncloneable
- 151: Reflect from Closures
- 153: Added functions for static initialisation
- 156: Removed var_dump to avoid spinning tests
- 157: Make sure variadic arguments are always optional
- 158: Run against lowest dependencies as well
- 160: Updated require versions ready for 1.0.0 release
0.1.0
Total issues resolved: 107
- 3: Refactored entire Reflector to be more flexible
- 4: Replace getClassesFromFile with a better API for getAllClasses
- 5: Resolve imported classes for phpdoc blocks
- 6: Move to use BetterReflection namespace
- 7: Need to become "mostly" compatible with PHP's Reflection API
- 8: Support "required" type enforcement on parameters
- 9: Compatibility for ReflectionParameter
- 10: Discover return types from DocBlocks
- 11: Added short messages that explain why some functionality will not be available
- 12: Add core reflection .phpt tests to ensure compatibility
- 13: Support ReflectionParameter->getClass()
- 16: Implement ReflectionObject
- 17: All BetterReflection reflection classes should implement \Reflector
- 18: Extend core \ReflectionClass etc.
- 19: CompileNodeToValue does not evaluate the value of constant expressions
- 23: Added some more documentation
- 24: Improve the unit test suite further
- 25: Reorganised tests and added @covers annotations
- 27: Fixed the DeclaringClass being null when finding types
- 28: Refactored TypesFinder static methods into invokable classes
- 29: Create context in FindParameterType type finder
- 30: Create context in FindTypeFromAst type finder
- 31: Context should be required parameter in ResolveTypes type finder
- 32: Improve coverage #24
- 33: ResolveTypes invokable now requires Context always
- 34: Implement lazy/runtime reflection
- 36: Implement "autoloading" source locator
- 40: Compatibility for ReflectionFunctionAbstract and ReflectionFunction
- 41: Add AutoloadSourceLocator enabling ReflectionClass and ReflectionFunction instantiation
- 42: [WIP\ Added core reflection tests
- 43: StringSourceLocator doesn't "locate" source, but returns a LocatedSource object
- 44: Use LocatedSource better
- 45: Context for FindParameterType
- 46: Context for FindTypeFromAst
- 47: FindPropertyType could fail when using StringSourceLocator
- 48: Ability to reflect globally declared constants
- 49: Added scrutinizer configs and some cheeky refactoring
- 51: CompileNodeToValue: compile array correctly
- 52: Fix resolution of imported namespaces within docblocks in params and properties
- 54: LocatedSource should check file exists / is file
- 55: Updating documentation a lot
- 56: Adds compatibility for ReflectionProperty
- 57: Implement Method->getPrototype() fully
- 58: Pretty much compatible ReflectionMethod
- 59: Compatibility for ReflectionClass
- 60: Update CS rules
- 107:
ReflectionClass#getMethods()
returns methods defined in the current source only (and not all scope visible/inherited methods) - 108:
ReflectionFunctionAbstract#$node
type is too generic - 110: Make ReflectionFunctionABstract#populateFunctionAbstract only accept specific nodes
- 111: Test failing (PHP7): testPopulateFunctionAbstractThrowsExceptionWithInvalidNode
- 112: Resolve TypeError in testPopulateFunctionAbstractThrowsExceptionWithInvalidNode
- 113: ReflectionClass#getMethods inheritance correction
- 115: Hotfix - evaled source locator should load only evaled classes
- 116: Hotfix - autoload source locator should also consider traits and interfaces
- 117: Hotfix - autoload source locator should ignore non existing files
- 118: Hotfix - generic reflector should not care about locator implementation
- 119:
PhpInternalSourceLocator
andEvaledCodeSourceLocator
can only stub classes - 120: Hotfix - #119 - workaround for stubbing internal and evaluated sources
- 123: SourceLocators should return definitely located source, not potentially located source
- 124: Add DefaultSourceLocator
- 125: Add the package license for composer
- 126: Delete composer.lock
- 128: added getImmediateMethods
- 129: added identifier accessor for IdentifierNotFoundException
- 132: Inconsistent capitalisation of method names in getDocBlock*
- 136: Internal refactoring of source locators
- 137: Be consistent with capitalisation of DocBlock
- 138: Digitalkaoz feature/immediate methods
- 139: More PHPT tests
- 143: Added autoload-dev.