Skip to content

Commit a3f1eed

Browse files
rodrigoprimopaulopmt1RafaelFunchal
authored
WP/DiscouragedConstants: add XML documentation (WordPress#2680)
* Adding documentation to WordPress.WP.DiscouragedConstants --------- Co-authored-by: paulopmt1 <paulopmt1@users.noreply.github.com> Co-authored-by: RafaelFunchal <RafaelFunchal@users.noreply.github.com>
1 parent fa02bc4 commit a3f1eed

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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="Discouraged Constants"
5+
>
6+
<standard>
7+
<![CDATA[
8+
The use of certain WordPress native constants is discouraged. Use the recommended alternatives instead.
9+
]]>
10+
</standard>
11+
<code_comparison>
12+
<code title="Valid: Function used instead of discouraged WP constant.">
13+
<![CDATA[
14+
$dir = <em>get_stylesheet_directory()</em>;
15+
]]>
16+
</code>
17+
<code title="Invalid: Discouraged WP constant is used.">
18+
<![CDATA[
19+
$dir = <em>STYLESHEETPATH</em>;
20+
]]>
21+
</code>
22+
</code_comparison>
23+
<standard>
24+
<![CDATA[
25+
The (re-)declaration of certain WordPress native constants is discouraged. Use the recommended alternatives instead.
26+
]]>
27+
</standard>
28+
<code_comparison>
29+
<code title="Valid: Using recommended alternative instead of (re-)declaring WP constant.">
30+
<![CDATA[
31+
<em>add_theme_support</em>(
32+
<em>'custom-header'</em>,
33+
array( 'width' => 200 )
34+
);
35+
]]>
36+
</code>
37+
<code title="Invalid: (Re-)declaring a WP constant.">
38+
<![CDATA[
39+
define(
40+
<em>'HEADER_IMAGE_WIDTH'</em>,
41+
200
42+
);
43+
]]>
44+
</code>
45+
</code_comparison>
46+
</documentation>

0 commit comments

Comments
 (0)