File tree Expand file tree Collapse file tree 4 files changed +36
-13
lines changed Expand file tree Collapse file tree 4 files changed +36
-13
lines changed Original file line number Diff line number Diff line change 122
122
123
123
<rule ref =" SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" />
124
124
<rule ref =" SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses" />
125
+ <!-- Allow global names with backslash like \Drupal. -->
126
+ <rule ref =" SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly" >
127
+ <properties >
128
+ <property name =" allowFullyQualifiedGlobalClasses" value =" true" />
129
+ <property name =" allowFullyQualifiedGlobalFunctions" value =" true" />
130
+ <property name =" allowFullyQualifiedGlobalConstants" value =" true" />
131
+ <property name =" allowFallbackGlobalFunctions" value =" true" />
132
+ <property name =" allowFallbackGlobalConstants" value =" true" />
133
+ </properties >
134
+ </rule >
135
+ <rule ref =" SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName" >
136
+ <exclude-pattern >*.api.php</exclude-pattern >
137
+ </rule >
138
+ <rule ref =" SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedNameWithoutNamespace" >
139
+ <severity >0</severity >
140
+ </rule >
125
141
<rule ref =" SlevomatCodingStandard.PHP.ShortList" />
126
142
127
143
<rule ref =" Squiz.Arrays.ArrayDeclaration" />
298
314
<exclude-pattern >*/\.svn/*</exclude-pattern >
299
315
<exclude-pattern >*/\.hg/*</exclude-pattern >
300
316
<exclude-pattern >*/\.bzr/*</exclude-pattern >
301
-
317
+
302
318
<!-- Ignore minified CSS files.-->
303
319
<exclude-pattern >*\.min\.css$</exclude-pattern >
304
320
</ruleset >
Original file line number Diff line number Diff line change 8
8
* without them.
9
9
* phpcs:disable Drupal.Commenting
10
10
*/
11
-
12
11
use Foo\Bar;
13
12
14
13
/**
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Drupal \mymodule ;
4
+
5
+ /**
6
+ * Some fluffy comment about the class.
7
+ */
8
+ class GoodNamespace {
9
+
10
+ /**
11
+ * Using \Drupal without a use statement is fine.
12
+ */
13
+ public static function version (): string {
14
+ return \Drupal::VERSION . phpversion () . \phpversion ();
15
+ }
16
+
17
+ }
Original file line number Diff line number Diff line change @@ -1397,17 +1397,6 @@ public function test() {
1397
1397
1398
1398
}
1399
1399
1400
- // Namespaced function call is allowed because PHP 5.5 and lower do not support
1401
- // use statements for functions.
1402
- $ default_config = [
1403
- 'verify ' => TRUE ,
1404
- 'timeout ' => 30 ,
1405
- 'headers ' => [
1406
- 'User-Agent ' => 'Drupal/ ' . \Drupal::VERSION . ' (+https://www.drupal.org/) ' . \GuzzleHttp \default_user_agent (),
1407
- ],
1408
- 'handler ' => $ stack ,
1409
- ];
1410
-
1411
1400
// camelCase and snake_case variables are allowed.
1412
1401
$ snake_case = 1 ;
1413
1402
$ camelCase = 1 ;
@@ -1819,3 +1808,5 @@ public function attributes(): void {
1819
1808
}
1820
1809
1821
1810
}
1811
+
1812
+ $ version = \Drupal::VERSION ;
You can’t perform that action at this time.
0 commit comments