- πΊπΈUnited States DamienMcKenna NH, USA
Just ran into this running the latest phpcs 3.9.2 against the Views codebase.
- πΊπΈUnited States DamienMcKenna NH, USA
I created a PR of JamesDevware's code: https://github.com/pfrenssen/coder/pull/228
- Status changed to RTBC
11 months ago 11:09am 2 May 2024 - πΊπΈUnited States DamienMcKenna NH, USA
I can confirm that the patch fixes the problem for me with Views.
- Status changed to Needs work
11 months ago 11:31am 2 May 2024 - π¦πΉAustria klausi π¦πΉ Vienna
thanks, the next step is to add a test case so that we can confirm that we are actually fixing something.
Can you add that to your PR?
-
klausi β
authored 10a7be4b on 8.3.x
fix(ScopeClosingBrace): Exclude sniff from PHP template files and fix...
-
klausi β
authored 10a7be4b on 8.3.x
- Status changed to Fixed
11 months ago 11:42am 5 May 2024 - π¦πΉAustria klausi π¦πΉ Vienna
I looked into this and noticed that this was already fixed upstream, so I synced our sniff from PHPCS.
I also disabled the ScopeClosingBraceSniff for template files - it does not make sense to run them on templates, since the braces follow the HTML indentation there.
I added a test case to demonstrate that there is no error, not perfect as the sniff is now disabled for templates, but good enough.
Then I found some interesting behavior in Drupal core with multi-line function declarations, improved our handling to allow empty "{}" function bodies.
Nice. I've tried empty function bodies in that format before.
Automatically closed - issue fixed for 2 weeks with no activity.