-
Notifications
You must be signed in to change notification settings - Fork 8.1k
ext/reflection: various cleanups and simplifications (2) #22660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DanielEScherzer
wants to merge
11
commits into
php:master
Choose a base branch
from
DanielEScherzer:reflection-cleanup-202607-r2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+632
−784
Open
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6ea723a
Fix inline documentation of `ReflectionParameter::isPassedByReference()`
DanielEScherzer 591514f
`ReflectionParameter::__construct()`: optimize closure checking
DanielEScherzer f44c8c7
`ReflectionClass::getMethods()`: optimize closure checking
DanielEScherzer d363409
Reflection: remove unused indentation support from `_parameter_string()`
DanielEScherzer 8bd459e
`ReflectionFunctionAbstract::getDocComment()`: use `zend_function.com…
DanielEScherzer 8d5ba54
Reflection: improve handling of dynamic properties in `_property_stri…
DanielEScherzer 4856fb9
Reflection: start cleaning up variable declarations
DanielEScherzer c42748d
Reflection: clean up variables for hash iteration
DanielEScherzer ba403df
Reflection: unhoist more variable declarations
DanielEScherzer 75064bb
Reflection: layout and indentation cleanup
DanielEScherzer 6e5dc76
Reflection: use early returns to reduce indentation
DanielEScherzer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2539,7 +2539,7 @@ ZEND_METHOD(ReflectionParameter, __construct) | |
| case IS_OBJECT: { | ||
| ce = Z_OBJCE_P(reference); | ||
|
|
||
| if (instanceof_function(ce, zend_ce_closure)) { | ||
| if (ce == zend_ce_closure) { | ||
| fptr = (zend_function *)zend_get_closure_method_def(Z_OBJ_P(reference)); | ||
| Z_ADDREF_P(reference); | ||
| is_closure = true; | ||
|
|
@@ -2840,7 +2840,7 @@ ZEND_METHOD(ReflectionParameter, allowsNull) | |
| } | ||
| /* }}} */ | ||
|
|
||
| /* {{{ Returns whether this parameters is passed to by reference */ | ||
| /* {{{ Returns whether this parameter is passed to by reference */ | ||
| ZEND_METHOD(ReflectionParameter, isPassedByReference) | ||
| { | ||
| reflection_object *intern; | ||
|
|
@@ -4550,7 +4550,7 @@ ZEND_METHOD(ReflectionClass, getMethods) | |
| _addmethod(mptr, ce, Z_ARRVAL_P(return_value), filter); | ||
| } ZEND_HASH_FOREACH_END(); | ||
|
|
||
| if (instanceof_function(ce, zend_ce_closure)) { | ||
| if (ce == zend_ce_closure) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto, probably should be a single commit with all the zend_ce_closure checks rather than multiple. |
||
| bool has_obj = Z_TYPE(intern->obj) != IS_UNDEF; | ||
| zval obj_tmp; | ||
| zend_object *obj; | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to add a comment just to explain it. As
instanceof_function()is always inlined to do this pointer comparison and only call the outlined slow function if not true.