Private properties, final meta class - #24
Open
jakubkulhan wants to merge 7 commits into
Open
Conversation
jakubkulhan
force-pushed
the
closure-access
branch
from
August 21, 2019 13:19
4302369 to
d3c6068
Compare
jakubkulhan
force-pushed
the
closure-access
branch
from
August 21, 2019 13:24
d3c6068 to
c64dbc9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors generated meta classes to use Closure::bind() hack - closure can be (re-)bound to a class scope, therefore it may access everything class' methods can access, i.e. private fields. Closure is created on-demand when method that needs it is called and it is cached - therefore this should introduce almost none performance degradation or greater memory consumption, however, I haven't run any benchmarks.
In addition to accessing private fields, this also permits creating meta classes for final classes as meta class don't need to extend original class anymore.
I've also bumped PHP version to 7.1, updated PHPUnit and did some cleanup.