File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
Universal/Docs/DeclareStatements Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <documentation xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi : noNamespaceSchemaLocation =" https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd"
4
+ title =" Declare Statements Style"
5
+ >
6
+ <standard >
7
+ <![CDATA[
8
+ Declare statements should, by default, be written without curly braces/alternative syntax.
9
+ ]]>
10
+ </standard >
11
+ <code_comparison >
12
+ <code title =" Valid: Declare statement written without curly braces." >
13
+ <![CDATA[
14
+ declare(strict_types=1);
15
+ ]]>
16
+ </code >
17
+ <code title =" Invalid: Declare statement written with curly braces." >
18
+ <![CDATA[
19
+ declare(encoding='ISO-8859-1', ticks=1) {
20
+ // Code.
21
+ }
22
+ ]]>
23
+ </code >
24
+ <code title =" Invalid: Declare statement written using alternative syntax." >
25
+ <![CDATA[
26
+ declare(encoding='ISO-8859-1', ticks=10):
27
+ declare(ticks=1):
28
+ // Code.
29
+ enddeclare;
30
+ enddeclare;
31
+ ]]>
32
+ </code >
33
+ </code_comparison >
34
+ <standard >
35
+ <![CDATA[
36
+ strict_types declaration directive mustn't be written using curly braces, or with alternative syntax.
37
+ ]]>
38
+ </standard >
39
+ <code_comparison >
40
+ <code title =" Valid: strict_types written without curly braces." >
41
+ <![CDATA[
42
+ declare(strict_types=1);
43
+ ]]>
44
+ </code >
45
+ <code title =" Invalid: strict_types written using alternative syntax/curly braces." >
46
+ <![CDATA[
47
+ declare(strict_types=1, ticks=1) {
48
+ // Code.
49
+ }
50
+ ]]>
51
+ </code >
52
+ </code_comparison >
53
+ </documentation >
You can’t perform that action at this time.
0 commit comments