Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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 Taxonomy module.
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 |
---|---|---|---|
#34 | 1807002-34.patch | 7.35 KB | idebr |
#34 | interdiff-26-34.txt | 13.08 KB | idebr |
Comments
Comment #1
Lars Toomre CreditAttribution: Lars Toomre commentedHere is a small patch that adds missing type hinting to the hook examples in taxonomy.api.php file.
Comment #2
Lars Toomre CreditAttribution: Lars Toomre commentedSetting to the right component.
Comment #3
seanrOne of them had the $ in the wrong spot. See attached.
Comment #5
seanrOuch, didn't realize how old this was - that file has completely changed now. Not sure if this is even relevant anymore.
Comment #6
Lars Toomre CreditAttribution: Lars Toomre commentedIt would be great if you went through this module now and added the type hints as appropriate. This issue was effectively created and then postponed until after API freeze to bring the docblocks up to snuff from a type hint perspective. I will review any patch you put forward @seanr.
Comment #7
seanrOnly found three that needed it. This patch should cover it now.
Comment #8
Jalandhar CreditAttribution: Jalandhar commentedPatch no longer applies. It needs reroll.
Comment #9
Jeroen CreditAttribution: Jeroen commentedComment #10
Jeroen CreditAttribution: Jeroen commentedThere's no more taxonomy.api.php file. I'm assuming Drupal 8 merged nodes and taxonomy terms into entities. The reroll isn't possible.
I did add some type hinting and moved some parameters from their class-type to the interface they implement.
Tests seem to still work.
Comment #11
Jeroen CreditAttribution: Jeroen commentedComment #12
Mile23Comment #13
Mile23Unsurprisingly, needs a reroll. :-)
Comment #14
adci_contributor CreditAttribution: adci_contributor commentedTrying to reroll.
Comment #15
Mile23phpcs tells me there are 'Missing parameter name' and 'Missing parameter type' errors in
/src/Controller/TermAutocompleteController.php
,/src/Plugin/views/filter/TaxonomyIndexTid.php
and/taxonomy.module
Comment #16
mrjmd CreditAttribution: mrjmd commentedI ran phpcs after applying the patch in #14 and found several more issues. Patch attached.
Comment #18
mrjmd CreditAttribution: mrjmd commentedOops, another try.
Also resisting the urge to fix the numerous other phpcs violations in this module :).
Comment #20
Mile23Comment #21
jibranThis needs re-roll after #1847596: Remove Taxonomy term reference field in favor of Entity reference
Comment #22
siva_epari CreditAttribution: siva_epari commentedPatch rerolled.
Comment #24
willzyx CreditAttribution: willzyx commentedAdded missing type hinting in
TermStorage
Comment #25
Mile23Still missing a bunch in
taxonomy.module
. Which shows me that I have a bug in myphpcs
review one-liner above... add a--extensions="module/php"
option.Comment #26
willzyx CreditAttribution: willzyx commentedComment #27
willzyx CreditAttribution: willzyx commentedComment #28
Mile23Patch in #26 has out-of-scope function signature hinting. We only want docblock changes here, for @param and @returns.
Bumping to 8.1.x.
Comment #34
idebr CreditAttribution: idebr at iO commentedRerolled against 8.6.x.
#28 Removed changes to function arguments
Fixed the following sniffs in the Taxonomy module:
Comment #40
quietone CreditAttribution: quietone as a volunteer commentedThis work is now being done by sniff. The work here is now in #3207949: Fix Drupal.Commenting.FunctionComment.MissingParamType so closing this as a duplicate. I've identified credit to add over there, let me know if I got it wrong.