Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding documentation for WordPress.Arrays.ArrayDeclarationSpacing #2489

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions WordPress/Docs/Arrays/ArrayDeclarationSpacingStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0"?>
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd"
title="Array Declaration Spacing"
>
<standard>
<![CDATA[
When an array uses associative keys, each pair of key and value must start on a new line.
]]>
</standard>
<code_comparison>
<code title="Valid: There is only one pair of key and value per line.">
<![CDATA[
$args = array(
<em>'post_id' => 22,
'category' => 1</em>
);
]]>
</code>
<code title="Invalid: More than one pair of key and value per line.">
<![CDATA[
$args = array(
<em>'post_id' => 22, 'category' => 1</em>
);
]]>
</code>
</code_comparison>
<standard>
<![CDATA[
Each item in a multi-line array must be on a new line.
]]>
</standard>
<code_comparison>
<code title="Valid: Only one array item per line.">
<![CDATA[
$args = array(
<em>'post_id',
'comment_count',
'post_type'</em>
);
]]>
</code>
<code title="Invalid: Multiple array items in the same line.">
<![CDATA[
$args = array(
<em>'post_id', 'comment_count', 'post_type'</em>
);
]]>
</code>
</code_comparison>
</documentation>
Loading