File tree 3 files changed +82
-0
lines changed
3 files changed +82
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ $ something = true ;
3
+ $ array = [1 ];
4
+ ?>
5
+
6
+ <!-- THIS IS WRONG -->
7
+ <?php if ($ something ) : ?>
8
+ <!-- do something -->
9
+ <?php else : ?>
10
+ <!-- do something else -->
11
+ <?php endif ; ?>
12
+
13
+ <?php foreach ($ array as $ a ) : ?>
14
+ <!-- foreach -->
15
+ <?php endforeach ; ?>
16
+
17
+ <?php switch ($ something ) : ?>
18
+ <?php case true : ?>
19
+ <!-- case is true -->
20
+ <?php endswitch ; ?>
21
+
22
+ <?php while (!$ something ) : ?>
23
+ <!-- I'm not being outputted -->
24
+ <?php endwhile ; ?>
25
+
26
+
27
+ <!-- THIS IS CORRECT -->
28
+ <?php if ($ something ): ?>
29
+ <!-- do something -->
30
+ <?php else : ?>
31
+ <!-- do something else -->
32
+ <?php endif ; ?>
33
+
34
+ <?php foreach ($ array as $ a ): ?>
35
+ <!-- foreach -->
36
+ <?php endforeach ; ?>
37
+
38
+ <?php switch ($ something ): ?>
39
+ <?php case true : ?>
40
+ <!-- case is true -->
41
+ <?php endswitch ; ?>
42
+
43
+ <?php while (!$ something ): ?>
44
+ <!-- I'm not being outputted -->
45
+ <?php endwhile ; ?>
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento2 \Tests \Templates ;
7
+
8
+ use PHP_CodeSniffer \Tests \Standards \AbstractSniffUnitTest ;
9
+
10
+ class AlternativeControlStructuresSyntaxUnitTest extends AbstractSniffUnitTest
11
+ {
12
+ /**
13
+ * @inheritdoc
14
+ */
15
+ public function getErrorList ()
16
+ {
17
+ return [];
18
+ }
19
+
20
+ /**
21
+ * @inheritdoc
22
+ */
23
+ public function getWarningList ()
24
+ {
25
+ return [
26
+ 7 => 1 ,
27
+ 9 => 1 ,
28
+ 13 => 1 ,
29
+ 17 => 1 ,
30
+ 18 => 1 ,
31
+ 22 => 1 ,
32
+ ];
33
+ }
34
+ }
Original file line number Diff line number Diff line change 431
431
<rule ref =" Squiz.ControlStructures.ControlSignature" >
432
432
<severity >6</severity >
433
433
<type >warning</type >
434
+ <properties >
435
+ <property name =" requiredSpacesBeforeColon" value =" 0" />
436
+ </properties >
434
437
</rule >
435
438
<rule ref =" Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace" >
436
439
<exclude-pattern >*.phtml</exclude-pattern >
You can’t perform that action at this time.
0 commit comments