Skip to content

Commit

Permalink
Update docs for the sniff
Browse files Browse the repository at this point in the history
Will probably need some fixup.
  • Loading branch information
dingo-d committed Sep 25, 2022
1 parent 4cd0963 commit 9cea8ac
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions Universal/Docs/DeclareStatements/BlockModeStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0"?>
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd"
title="Declare Statements Block Mode"
>
<standard>
<![CDATA[
Defines the block mode usage of declare directives.
]]>
</standard>
<code_comparison>
<code title="Valid: Declare statement written in non-block mode.">
<![CDATA[
declare(strict_types=1);
declare(encoding='utf-8');
declare(ticks=10):
// Code.
enddeclare;
]]>
</code>
<code title="Invalid: Declare statement written with curly braces or alternative syntax.">
<![CDATA[
declare(encoding='ISO-8859-1', ticks=1) {
// Code.
}
declare(encoding='ISO-8859-1', ticks=10):
declare(encoding='utf-8'):
// Code.
enddeclare;
enddeclare;
]]>
</code>
</code_comparison>
<standard>
<![CDATA[
strict_types declaration directive mustn't be written using curly braces, or with alternative syntax.
]]>
</standard>
<code_comparison>
<code title="Valid: strict_types written without curly braces.">
<![CDATA[
declare(strict_types=1);
]]>
</code>
<code title="Invalid: strict_types written using alternative syntax/curly braces.">
<![CDATA[
declare(strict_types=1, ticks=1) <em>{</em>
// Code.
<em>}</em>
]]>
</code>
</code_comparison>
</documentation>

0 comments on commit 9cea8ac

Please sign in to comment.