-
Notifications
You must be signed in to change notification settings - Fork 8k
Add DocComments for function parameters #21279
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
chschneider
wants to merge
7
commits into
php:master
Choose a base branch
from
chschneider:parameter-doccomments
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.
+241
−13
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6d13363
Add DocComments for function parameters
1bab302
Add missing arg_info doc_comment handling for accelerator/persist
a873d33
Remove interning string as it seems to cause problems
86279be
Add tests for methods, closures, // comments and parameters with DocC…
a85e262
Do not add @tentative-return-type for newly introduced methods
a0f0577
Commit generated declaration files
eb3114e
Add test for property hook parameter
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
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
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
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
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
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
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
194 changes: 194 additions & 0 deletions
194
ext/reflection/tests/ReflectionParameter_getDocComment_basic.phpt
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 |
|---|---|---|
| @@ -0,0 +1,194 @@ | ||
| --TEST-- | ||
| Test ReflectionParameter::getDocComment() usage. | ||
| --INI-- | ||
| opcache.save_comments=1 | ||
| --FILE-- | ||
| <?php | ||
|
|
||
| class A | ||
| { | ||
| function func( | ||
| /** | ||
| * My Doc Comment for $a | ||
| * | ||
| */ | ||
| $a, $b, $c, | ||
| /** | ||
| * My Doc Comment for $d | ||
| */ | ||
| $d, | ||
| // Not a doc comment | ||
| /**Not a doc comment */ | ||
| $e, | ||
| /** | ||
| * Doc comment for $f | ||
| */ | ||
| $f, | ||
| $g /** Doc comment for $g behind parameter */, | ||
| /** Doc comment for $h */ | ||
| $h /** Doc comment for $h behind parameter */, | ||
| ) {} | ||
|
|
||
| public string $property { | ||
| set( | ||
| /** Doc Comment for property hook parameter $value */ | ||
| string $value | ||
| ) { $this->property = $value; } | ||
| } | ||
| } | ||
|
|
||
| function func( | ||
| /** | ||
| * My Doc Comment for $a | ||
| * | ||
| */ | ||
| $a, $b, $c, | ||
| /** | ||
| * My Doc Comment for $d | ||
| */ | ||
| $d, | ||
| // Not a doc comment | ||
| /**Not a doc comment */ | ||
| $e, | ||
| /** | ||
| * Doc comment for $f | ||
| */ | ||
| $f, | ||
| $g /** Doc comment for $g behind parameter */, | ||
| /** Doc comment for $h */ | ||
| $h /** Doc comment for $h behind parameter */, | ||
| ) {} | ||
|
|
||
| $func = function( | ||
| /** | ||
| * My Doc Comment for $a | ||
| * | ||
| */ | ||
| $a, $b, $c, | ||
| /** | ||
| * My Doc Comment for $d | ||
| */ | ||
| $d, | ||
| // Not a doc comment | ||
| /**Not a doc comment */ | ||
| $e, | ||
| /** | ||
| * Doc comment for $f | ||
| */ | ||
| $f, | ||
| $g /** Doc comment for $g behind parameter */, | ||
| /** Doc comment for $h */ | ||
| $h /** Doc comment for $h behind parameter */, | ||
| ) {}; | ||
|
|
||
| foreach([ | ||
| 'A::func' => (new ReflectionClass('A'))->getMethod('func'), | ||
| 'func' => new ReflectionFunction('func'), | ||
| 'closure' => new ReflectionFunction($func), | ||
| 'property hook' => (new ReflectionClass('A'))->getProperty('property')->getHook(PropertyHookType::Set), | ||
| ] as $function => $rc) { | ||
| $rps = $rc->getParameters(); | ||
| foreach($rps as $rp) { | ||
| echo "\n---> Doc comment for $function parameter $" . $rp->getName() . ":\n"; | ||
| var_dump($rp->getDocComment()); | ||
| } | ||
| } | ||
|
|
||
| ?> | ||
| --EXPECTF-- | ||
| ---> Doc comment for A::func parameter $a: | ||
| string(%d) "/** | ||
| * My Doc Comment for $a | ||
| * | ||
| */" | ||
|
|
||
chschneider marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ---> Doc comment for A::func parameter $b: | ||
| bool(false) | ||
|
|
||
| ---> Doc comment for A::func parameter $c: | ||
| bool(false) | ||
|
|
||
| ---> Doc comment for A::func parameter $d: | ||
| string(%d) "/** | ||
| * My Doc Comment for $d | ||
| */" | ||
|
|
||
| ---> Doc comment for A::func parameter $e: | ||
| bool(false) | ||
|
|
||
| ---> Doc comment for A::func parameter $f: | ||
| string(%d) "/** | ||
| * Doc comment for $f | ||
| */" | ||
|
|
||
| ---> Doc comment for A::func parameter $g: | ||
| string(%d) "/** Doc comment for $g behind parameter */" | ||
|
|
||
| ---> Doc comment for A::func parameter $h: | ||
| string(%d) "/** Doc comment for $h behind parameter */" | ||
|
|
||
| ---> Doc comment for func parameter $a: | ||
| string(%d) "/** | ||
| * My Doc Comment for $a | ||
| * | ||
| */" | ||
|
|
||
| ---> Doc comment for func parameter $b: | ||
| bool(false) | ||
|
|
||
| ---> Doc comment for func parameter $c: | ||
| bool(false) | ||
|
|
||
| ---> Doc comment for func parameter $d: | ||
| string(%d) "/** | ||
| * My Doc Comment for $d | ||
| */" | ||
|
|
||
| ---> Doc comment for func parameter $e: | ||
| bool(false) | ||
|
|
||
| ---> Doc comment for func parameter $f: | ||
| string(%d) "/** | ||
| * Doc comment for $f | ||
| */" | ||
|
|
||
| ---> Doc comment for func parameter $g: | ||
| string(%d) "/** Doc comment for $g behind parameter */" | ||
|
|
||
| ---> Doc comment for func parameter $h: | ||
| string(%d) "/** Doc comment for $h behind parameter */" | ||
|
|
||
| ---> Doc comment for closure parameter $a: | ||
| string(%d) "/** | ||
| * My Doc Comment for $a | ||
| * | ||
| */" | ||
|
|
||
| ---> Doc comment for closure parameter $b: | ||
| bool(false) | ||
|
|
||
| ---> Doc comment for closure parameter $c: | ||
| bool(false) | ||
|
|
||
| ---> Doc comment for closure parameter $d: | ||
| string(%d) "/** | ||
| * My Doc Comment for $d | ||
| */" | ||
|
|
||
| ---> Doc comment for closure parameter $e: | ||
| bool(false) | ||
|
|
||
| ---> Doc comment for closure parameter $f: | ||
| string(%d) "/** | ||
| * Doc comment for $f | ||
| */" | ||
|
|
||
| ---> Doc comment for closure parameter $g: | ||
| string(%d) "/** Doc comment for $g behind parameter */" | ||
|
|
||
| ---> Doc comment for closure parameter $h: | ||
| string(%d) "/** Doc comment for $h behind parameter */" | ||
|
|
||
| ---> Doc comment for property hook parameter $value: | ||
| string(%d) "/** Doc Comment for property hook parameter $value */" | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.