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
While reviewing #2805449: Comment out 'extension_discovery_scan_tests' in example.settings.local.php I found that example.settings.php has a code style violation in:
assert_options(ASSERT_ACTIVE, TRUE);
\Drupal\Component\Assertion\Handle::register();
The class reference should use a "use" statement.
Proposed resolution
Ignore coding standards in sites/* PHP files as these files are not really for code but are used to configure your drupal install.
Remaining tasks
Do it.
User interface changes
N/A.
API changes
N/A.
Data model changes
N/A.
Comment | File | Size | Author |
---|---|---|---|
#4 | example_settings_php-2915673-4.patch | 953 bytes | borisson_ |
Comments
Comment #2
alexpottThere's a wider issue of applying coding standards declared in ./core to things outside of ./core such as this file. https://github.com/alexpott/d8githooks will blindly test any PHP file against the coding standards ignoring its location. We have 3 PHP files outside of ./core to think about:
And currently we have the following violations:
We could decide that the nature of these files means that we should just add
At the top. As nothing is actually wrong. Our coding standards are not really for code include in the main execution of the file like
Comment #3
alexpottMy vote is just to add
And be done.
Comment #4
borisson_I agree with @alexpott that we should just ignore coding standards.
Attached is patch that does that.
Comment #5
borisson_Oh, I didn't see that this was Novice when I started working on it. Sorry for stealing this issue.
Comment #6
dev.patrick CreditAttribution: dev.patrick at TATA Consultancy Services for Pfizer, Inc. commented@borisson_ patch is applied cleanly. Considering suggestion by @alexpott, its worth that we can ignore coding standard here. Moving to RTBC, open for more suggestion and if need to move to N/W N/R.
Comment #7
alexpottComment #8
alexpottComment #12
xjmCommitted to 8.5.x. Thanks! I originally also backported it to 8.4.x, but on second thought I came to the conclusion that it wasn't worth the settings.php changes for the production branch (since even a comment-only change to those could trigger production sites to redo their settings.php.)