Page MenuHomeWickedGov Phorge

DuplicateArrayKeyStandard.xml
No OneTemporary

Size
1001 B
Referenced Files
None
Subscribers
None

DuplicateArrayKeyStandard.xml

<?xml version="1.0"?>
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd"
title="Duplicate Array Key"
>
<standard>
<![CDATA[
When a second array item with the same key is declared, it will overwrite the first.
This sniff detects when this is happening in array declarations.
]]>
</standard>
<code_comparison>
<code title="Valid: Arrays with unique keys.">
<![CDATA[
$args = array(
<em>'foo'</em> => 22,
<em>'bar'</em> => 25,
<em>'baz'</em> => 28,
);
$args = array(
22,
25,
2 => 28,
);
]]>
</code>
<code title="Invalid: Array with duplicate keys.">
<![CDATA[
$args = array(
<em>'foo'</em> => 22,
<em>'bar'</em> => 25,
<em>'bar'</em> => 28,
);
$args = array(
22,
25,
1 => 28,
);
]]>
</code>
</code_comparison>
</documentation>

File Metadata

Mime Type
text/xml
Expires
Mon, Nov 23, 06:23 (3 d, 12 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
48/ac/54bab5e77d769230a626ac46e32c
Default Alt Text
DuplicateArrayKeyStandard.xml (1001 B)

Event Timeline