基础代码

This commit is contained in:
2021-02-26 22:23:13 +08:00
parent 7884df52f0
commit a719feebba
2585 changed files with 328263 additions and 0 deletions
@@ -0,0 +1,23 @@
<documentation title="Cast Structure Spacing">
<standard>
<![CDATA[
A type cast should be preceded by whitespace.
There is only one exception to this rule: when the cast is preceded by the spread operator there should be no space between the spread operator and the cast.
]]>
</standard>
<code_comparison>
<code title="Valid: space before typecast.">
<![CDATA[
$a =<em> </em>(int) '420';
// No space between spread operator and cast.
$a = function_call( <em>...(array)</em> $mixed );
]]>
</code>
<code title="Invalid: no space before typecast.">
<![CDATA[
$a <em>=(</em>int) '420';
]]>
</code>
</code_comparison>
</documentation>
@@ -0,0 +1,25 @@
<documentation title="Disallow Inline Tabs">
<standard>
<![CDATA[
Use spaces for inline alignment.
]]>
</standard>
<code_comparison>
<code title="Valid: spaces used for inline alignment.">
<![CDATA[
$a = array(
'abc'<em>[space]</em>=> 'lor',
'b'<em>[space][space][space]</em>=> 'em',
);
]]>
</code>
<code title="Invalid: tabs used for inline alignment.">
<![CDATA[
$a = array(
'abc'<em>[tab]</em>=> 'lor',
'b'<em>[tab]</em>=> 'em',
);
]]>
</code>
</code_comparison>
</documentation>
@@ -0,0 +1,31 @@
<documentation title="Precision Alignment">
<standard>
<![CDATA[
Line indentation should only use tabs. Precision alignment with spaces after the tabs is strongly discouraged.
]]>
</standard>
<code_comparison>
<code title="Valid: only tabstops used for indentation.">
<![CDATA[
<em>[tab]</em>$var = true;
]]>
</code>
<code title="Invalid: precision alignment of 2 spaces.">
<![CDATA[
<em>[space][space]</em>$var = true;
]]>
</code>
</code_comparison>
<code_comparison>
<code title="Valid: four spaces counts as a tab, the replacement of these will be handled by another sniff.">
<![CDATA[
<em>[tab][space][space][space][space]</em>$var = true;
]]>
</code>
<code title="Invalid: precision alignment of 3 spaces.">
<![CDATA[
<em>[tab][space][space][space]</em>$var = true;
]]>
</code>
</code_comparison>
</documentation>