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
Anonymous classes are here why not use them?
Steps to reproduce
Scroll down to the end of the RecursiveContextualValidatorTest.php
Proposed resolution
Replace the dummy test class with the anonymous class.
Remaining tasks
- Review the patch
- RTCB the patch
- Rejoice!
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
N/A
Comment | File | Size | Author |
---|---|---|---|
#7 | 3311214-7.patch | 1.05 KB | jibran |
|
Comments
Comment #2
jibranComment #3
lauriiiI think we should search if there are other instances where we'd like to use anonymous classes. I found at least
\Drupal\Tests\Component\Utility\VariableTest
Comment #4
jibranWe can't replace the class in VariableTest with anonymous class. Changing it breaks the test.
Comment #5
jibranI tired searching for following pattern
class\s+([a-zA-Z0-9_]+)\s*\{(\s*)\}
in core and didn't find any worthy candidates.Comment #6
Anchal_gupta CreditAttribution: Anchal_gupta at Srijan | A Material+ Company for Drupal India Association commentedI have fixed the custom command that failed. Please review it
Comment #7
jibranThis should be the correct way to fix this.
Comment #8
Wim LeersNice clean-up!
Comment #9
alexpottCommitted and pushed 6cbea8d6fd to 10.1.x and 2f58ef657a to 10.0.x and 9c8bdd9b80 to 9.5.x. Thanks!
Backported to 9.5.x to keep everything aligned.
Better way to fix the coding standard issue.