Skip to content

Commit 74ee334

Browse files
dingo-djrfnl
authored andcommitted
Update docs for the sniff
Will probably need some fixup.
1 parent 98925a9 commit 74ee334

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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 Block Mode"
5+
>
6+
<standard>
7+
<![CDATA[
8+
Defines the block mode usage of declare directives.
9+
]]>
10+
</standard>
11+
<code_comparison>
12+
<code title="Valid: Declare statement written in non-block mode.">
13+
<![CDATA[
14+
declare(strict_types=1);
15+
16+
declare(encoding='utf-8');
17+
18+
declare(ticks=10):
19+
// Code.
20+
enddeclare;
21+
]]>
22+
</code>
23+
<code title="Invalid: Declare statement written with curly braces or alternative syntax.">
24+
<![CDATA[
25+
declare(encoding='ISO-8859-1', ticks=1) {
26+
// Code.
27+
}
28+
29+
declare(encoding='ISO-8859-1', ticks=10):
30+
declare(encoding='utf-8'):
31+
// Code.
32+
enddeclare;
33+
enddeclare;
34+
]]>
35+
</code>
36+
</code_comparison>
37+
<standard>
38+
<![CDATA[
39+
strict_types declaration directive mustn't be written using curly braces, or with alternative syntax.
40+
]]>
41+
</standard>
42+
<code_comparison>
43+
<code title="Valid: strict_types written without curly braces.">
44+
<![CDATA[
45+
declare(strict_types=1);
46+
]]>
47+
</code>
48+
<code title="Invalid: strict_types written using alternative syntax/curly braces.">
49+
<![CDATA[
50+
declare(strict_types=1, ticks=1) <em>{</em>
51+
// Code.
52+
<em>}</em>
53+
]]>
54+
</code>
55+
</code_comparison>
56+
</documentation>

0 commit comments

Comments
 (0)