This is a sub-issue of #1800046: [META] Add missing type hinting to core docblocks, fix Drupal.Commenting.FunctionComment.Missing* focused on correctly adding @param and @return type hinting to the Simpletest module. This does not include the base test files in lib\Drupal\simpletest. Those files are being covered by Issue [].
Documentation patches that include type hinting are time consuming to both review and commit because one must dig into the actual code to confirm that the type hints are both correct and complete. Hence, please be patient and try to limit type hint patches to covering only a limited number of docblocks (20-25 as a guess).
How To Review This Issue
- Attempt to apply the patch to see if it needs a reroll.
- Use the phpcs one-liner to evaluate whether all the relevant standards errors have been resolved: https://gist.github.com/paul-m/227822ac7723b0e90647
- Look at each change and determine whether the type hint is correct.
Related sprint issues:
Comment | File | Size | Author |
---|---|---|---|
#49 | 1805340-49.patch | 34.08 KB | snehalgaikwad |
#37 | 1805340_37.patch | 45.6 KB | Mile23 |
| |||
#35 | 1805340_35.patch | 45.87 KB | Mile23 |
| |||
#32 | add-missing-type-hinting-to-Simpletest-module-docblocks-1805340-#32.patch | 51.66 KB | deepakaryan1988 |
#28 | interdiff.txt | 7.63 KB | mrjmd |
Comments
Comment #1
Lars Toomre CreditAttribution: Lars Toomre commentedPostponing until #1431636: Clean up API docs for simpletests module (excluding files subdirectory) is committed to D8.
Comment #2
Lars Toomre CreditAttribution: Lars Toomre commentedHere is a small patch adding type hinting to the missing hooks in simpletest.api.php file.
Comment #3
Mile23The blocking issue is marked closed.
Comment #4
YesCT CreditAttribution: YesCT commentedI would be willing to review or work on this.
Comment #5
Mile23Patch in #2 wouldn't apply, but the changes are reflected here, as well.
Try the API docs, .module file, and unit tests for starters.
Comment #6
filijonka CreditAttribution: filijonka commenteda reroll, mostly removing stuff from the patch cause it's been taken care of already
Comment #11
Mile23MOAR.
Note that I kind of generated this in the process: #2403007: Drupal\simpletest\WebTestBase::drupalHead doesn't store results despite documentation..
This patch fixes these files:
Note that I used a phpcs/NetBeans toolchain to find the errors, and you can use it to review the patch, like this: http://youtu.be/H6pWz_6XoiQ
Comment #13
Mile23This might be a little out of scope but it solves the issue and improves the documentation.
Comment #15
Mile23Comment #16
Mile23OK, so it doesn't solve the problem. Reverting back to the original code, changing only the docblock.
Comment #17
Mile23Comment #18
Mile23Comment #19
mrjmd CreditAttribution: mrjmd commentedReroll attached. There were conflicts in WebTestBase.php and simpletest.module, both because a few types in head were being hinted like this:
@param \Drupal\Core\Url|string $path
I switched them to just:
@param string $path
But I'm not sure that's right. I also fixed a typo from the patch in #16 that had "arrau" instead of array for a type hint for function drupalGet().
Comment #22
daffie CreditAttribution: daffie commentedThe patch looks good.
In both instances the parameter can be an URL. So can you remove these changes.
Comment #23
mrjmd CreditAttribution: mrjmd commentedThanks for the feedback @daffie, I've added those back in and rerolled.
There was one conflict in /core/modules/simpletest/tests/src/Unit/TestBaseTest.php, looks like a method had been renamed while making our fix obsolete.
Comment #24
daffie CreditAttribution: daffie commentedLooks good to me. Thanks mrjmd for the reroll.
This issue is all about documention of tests. So allowed as a beta change.
Comment #25
Mile23Still applies.
Comment #26
Mile23Comment #27
alexpottShouldn't we be type-hinting in the function too? Eg:
Also:
Needs a new line before the file doc.
Comment #28
mrjmd CreditAttribution: mrjmd commentedI've added typehints to the function names everywhere phpcs pointed them out, and added the new line before the file doc. There are still a lot of other phpcs warnings in simpletest but I didn't want to go out of scope for this issue.
Comment #30
Mile23Some of the issues for this meta include type hinting in the function signatures, some don't.
My understanding is that ones which do not can be documentation issues, whereas ones which do are code changes. A maintainer could please talk about such a distinction on the meta if it matters.
Comment #31
deepakaryan1988Comment #32
deepakaryan1988Re-rolling the patch#28
Comment #33
deepakaryan1988Comment #35
Mile23All docblock @param and @return filled in.
Running the phpcs gist in the issue summary only yields one false-positive CS error. (It's complaining about the lack of description in a @param, but the type hinting is there.)
Comment #37
Mile23Turns out we can get documentation into 8.0.x.
Needed a re-roll, but I couldn't get that to work easily, so I used
git apply --reject
and re-did the other work. This only affectedWebTestBase.php
.phpcs reports only one false-positive of a @param without a comment.
Comment #42
Mile23Comment #43
Mile23There's another issue for base test classes, which are arguably more important: #1805346: Add missing type hinting to base test classes in Simpletest module docblocks
Comment #49
snehalgaikwad CreditAttribution: snehalgaikwad as a volunteer and at QED42 for Drupal India Association commentedComment #50
quietone CreditAttribution: quietone as a volunteer commentedThe simpletest module is no longer in core, moving to the SimpleTest project.
Comment #51
quietone CreditAttribution: quietone as a volunteer commentedIt doesn't seem to make sense to have this as a child of a core issue, so removing parent.