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 Filter 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 |
|---|---|---|---|
| #21 | add_missing_type-1811328-21.patch | 4.04 KB | sushyl |
| #15 | add_missing_type-1811328-15.patch | 4.15 KB | sushyl |
| #4 | 1811328_4.patch | 5.12 KB | mile23 |
Comments
Comment #1
lars toomre commentedMarking as postponed until D8 change in #1347914: Clean up API docs for Filter module are committed to D8.
Comment #2
mile23Comment #3
mile23#1347914: Clean up API docs for Filter module is marked fixed, and even backported to D7.
phpcs tells me there are 'Missing parameter type' errors in
filter.module,FilterUnitTest.php, andfilter.api.php.So I'm setting this as active.
Comment #4
mile23Patch.
Comment #6
mile23The last patch only changed docblocks, so I'm going to re-run the testbot.
Comment #8
mile23Still applies, still no missing type hinting according to phpcs.
Comment #9
mile23Still applies.
Comment #10
mile23Comment #11
rishikant05 commentedComment #12
rishikant05 commentedThis patch is working.
Comment #13
rishikant05 commentedComment #14
mile23Bumping to 8.1.x. Patch no longer applies.
Comment #15
sushyl[8.1.x-dev] Updated Patch.
Comment #16
sushylComment #17
claudiu.cristeaSorry, I think docs-only patches should go ASAP in HEAD. That's because they are non-invasive and they cannot break anything but, in the same time, are helping a lot the developers that are porting modules and also are improving the DX in most of IDEs.
Comment #18
jhodgdonYes, should be 8.0.x for sure.
Comment #19
naveenvalechaPatch sucessfully applied on 8.0.x
phpcs reports nothing.All looks good to be in. Thanks!
Comment #20
jhodgdonThese patches need to be reviewed VERY CAREFULLY, looking at the code, to make sure that the types that are added are correct.
The review here was not quite careful enough, and this patch is not quite right:
The type here is incorrect.
$format is actually an object of type FilterFormat. So the type should be listed as
\Drupal\filter\FilterFormatInterface
not "object".
Comment #21
sushylGood catch @jhodgdon!
I see what you're talking about here. I really wonder how you could find such a small mistake. (Respect)
Fixed the patch, re-uploading.
Comment #22
jhodgdonThanks!
Comment #23
claudiu.cristeaNice docs cleanup. Let's fix then the rest of module too, not only procedural functions :)
Missing the @return tag.
Should be false (lowercase)
Missing doc-block. Only {@inheritdoc}
Missing @param and the function should be protected.
Missing doc-block. Only {@inheritdoc}
Missing doc-block. Only {@inheritdoc}
and
\Drupal\filter\Tests\FilterFormTest::$webUser
Both should be \Drupal\user\UserInterface
Missing doc-block. Only {@inheritdoc}
Missing doc-block. Only {@inheritdoc}
Missing doc-block. Only {@inheritdoc}
FilterInterface should be full qualified. @param $tests missing typehint.
@return array|FALSEShould be false (lowercase)
@return $thisThis is wrong. We should show the type-hint not the value. Replace $this with \Drupal\filter\FilterProcessResult
\Drupal\Tests\filter\Unit\Plugin\migrate\source\d6\FilterFormatTest::$migrationConfiguration
\Drupal\Tests\filter\Unit\Plugin\migrate\source\d6\FilterFormatTest::$expectedResults
Missing doc-block.
\Drupal\Tests\filter\Unit\Plugin\migrate\source\d7\FilterFormatTest::$migrationConfiguration
\Drupal\Tests\filter\Unit\Plugin\migrate\source\d7\FilterFormatTest::$expectedResults
Missing doc-block.
Comment #24
jhodgdonRegarding #23, this issue needs to stay focused ONLY on fixing missing type hinting, not in fixing up other problems in doc blocks. See
https://www.drupal.org/core/scope
It doesn't look like the issues raised in #23 are in scope for this issue. Please open separate issues for them... although several are incorrect. For instance, we do want to have doc blocks that are just "inheritdoc" and @return $this is correct to use... Please take a look at https://www.drupal.org/node/1354 for documentation standards and read the Issue Scope page linked above before filing more issues about those items... thanks!
Meanwhile, this issue is complete for its scope. See #19 where the coder rule came up clean...
Comment #27
catchCommitted/pushed to 8.1.x and cherry-picked to 8.0.x, thanks!