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.
Problem/Motivation
The custom sniff Drupal.WhiteSpace.OperatorSpacing
does not allow to use declare(strict_types=1);
The default sniff Squiz.WhiteSpace.OperatorSpacing
already allow this since https://github.com/squizlabs/PHP_CodeSniffer/issues/1163.
Furthermore the custom sniff Drupal.WhiteSpace.OperatorSpacing
specifies Overrides Squiz_Sniffs_WhiteSpace_OperatorSpacingSniff to allow the plus operator on numbers like "$i = +1;".
but the default one seems to also allow this.
The question is: Is it still necessary to override Squiz.WhiteSpace.OperatorSpacing
?
Proposed resolution
- Yes: We should update
Drupal.WhiteSpace.OperatorSpacing
to allowdeclare(strict_types=1);
- No: Remove
Drupal.WhiteSpace.OperatorSpacing
Remaining tasks
- Take a decision
- Apply it
I'll be happy to provide the patch :)
User interface changes
None
API changes
None?
Data model changes
None
Release notes snippet
TODO
Comments
Comment #2
klausiThanks for opening this issue!
If we can remove Drupal.WhiteSpace.OperatorSpacing then we should do it. If we have test cases for it we should move them to good.php and bad.php then.
If it turns out that we can't remove it then fixing it is fine to allow
declare(strict_types=1);
.Please create a pull request against https://github.com/pfrenssen/coder , then we see the automated test cases run.
Comment #3
beram CreditAttribution: beram as a volunteer and at Ekino commentedSee https://github.com/pfrenssen/coder/pull/62 :)
Off topic: I did not know that coder was on github! Could it be interesting to add the repository URL on the project page? I would have directly provided the PR instead if I've known this ^^
Comment #5
klausiThanks, merged!
Good point about the project page, will try to link Github better there :-)
Comment #7
BR0kENThis became a BC for Drupal core.