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.
Follow-up to #2708179: Fix 'Drupal.Commenting.FunctionComment' coding standard - Issues related to @throws
This is a part of the attempt to fix #2572645: [Meta] Fix 'Drupal.Commenting.FunctionComment' coding standard
Since we don't have an automated coding standards test, we see regressions.
We also see 'new regressions' since Coder 8.2.8 was released.
This issue catches those regressions, so we can move forward on other coding standards issues.
Comment | File | Size | Author |
---|---|---|---|
#6 | 2747073_6.patch | 1.87 KB | Mile23 |
#3 | 2747073_3.patch | 1.34 KB | Mile23 |
#2 | 2742599_2.patch | 1.9 KB | Mile23 |
Comments
Comment #2
Mile23Comment in
TwigTransTokenParser.php
is taken from the exception message.I removed
@throws
fromJavascriptTestBase.php
because it doesn't throw\PHPUnit_Framework_AssertionFailedError
. None of the other functions it calls return that error, either. So if it does throw that, it's through a side-effect I don't understand.Comment #3
Mile23Hmm. Looks like that's the wrong patch. :-)
Comment #4
dawehnerOH yeah, that annoyed me all the time already :)
This is wrong.
$this->assertTrue()
throws it, see\PHPUnit_Framework_Assert::assertTrue()
Comment #5
klausiThe patch is not needed for coding standards because exceptions do not need to have a description per Drupal coding standards. This was fixed in the latest Coder release already, please upgrade.
Comment #6
Mile23OK, so the patch above solves regressions from Coder 8.2.7.
Here's a patch that solves regressions from Coder 8.2.8.
Comment #7
dawehnerCan we open new issues for this new 2 rules?
Comment #9
klausiI think it is fine to fix it in this issue. I tested the patch with the most recent dev version of Coder and it work as expected. No errors found when phpcs is executed.
Comment #10
alexpottCommitted 4babdeb and pushed to 8.1.x. Thanks!
Committed c945189 and pushed to 8.2.x. Thanks!
Committed f24af6a and pushed to 8.3.x. Thanks!
Just the changes to phpcs.xml.dist was back ported to 8.1.x
Comment #14
pfrenssenCreated followup issues to fix the new sniffs: #2783393: Fix 'Drupal.Commenting.FunctionComment.IncorrectParamVarName' coding standard and #2783395: Fix 'Drupal.Commenting.FunctionComment.InvalidReturn' coding standard.