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.
Running coder on HEAD results in PHP Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Referenced sniff "Drupal.Functions.FunctionDeclaration.SpaceAfter" does not exist' in /Users/alex/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.php:1121
The commit
* d39172e - Removed function declaration sniff, now covered by upstream Squiz sniff (3 days ago)
broke stuff.
Comment | File | Size | Author |
---|---|---|---|
#10 | 2710219.10.patch | 1.5 KB | alexpott |
#5 | 2710219.5.patch | 4.59 KB | alexpott |
Comments
Comment #2
alexpottAh I see... Drupal 8 only works with 8.2.7 because we've got Drupal.Functions.FunctionDeclaration in our phpcs.xml.dist
Shouldn't dropping rules only occur in major versions?
Comment #3
alexpottComment #4
klausiNow that people use phpcs.xml files all over the place we should not drop classes anymore. Let's put back an empty class, mark it as deprecated and remove it in a future 9.x version.
Comment #5
alexpottHere's a patch that reverts the breaking change.
Comment #6
alexpottAlternatively you can just do
git revert d39172e
Comment #7
klausiNah, I would rather like to rely on upstream PHPCS code which also comes with a fixer.
Empty class should be enough, right?
Comment #8
alexpottThat's a breaking change because people with it in phpcs.xml are going to assume it is testing something.
Comment #9
alexpottMaybe we can just extend from the Squizz class...
Comment #10
alexpottHere's a way of fixing it whilst still maintaining the sniff. It does mean we get some double testing but that's going to be necessary if we want the improvements that the change included.
Comment #11
klausiHm, another approach would be to restore the sniff and disable it ruleset.xml. That way we can deprecate the class while leaving it intact and we avoid double errors reported.
Comment #12
alexpottBut then we lose test coverage - right?
Comment #13
klausiI don't think so, since the only test coverage for this old sniff is in bad.php. That is tested with all rules defined in ruleset.xml.
Comment #15
klausiCommitted that approach.