-
-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for WordPress.NamingConventions.ValidVariableName
- Loading branch information
1 parent
29488fe
commit 10da904
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
WordPress/Docs/NamingConventions/ValidVariableNameStandard.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0"?> | ||
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" | ||
title="Valid Variable Name" | ||
> | ||
<standard> | ||
<![CDATA[ | ||
Use lowercase letters in variable names. Separate words using underscores. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: lowercase variable name."> | ||
<![CDATA[ | ||
<em>$prefix_variable_name</em> = 'value'; | ||
]]> | ||
</code> | ||
<code title="Invalid: mixed case function name."> | ||
<![CDATA[ | ||
<em>$Prefix_Variable_NAME</em> = 'value'; | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<code_comparison> | ||
<code title="Valid: words separated by underscores."> | ||
<![CDATA[ | ||
class My_Class { | ||
public $variable_name = 'value'; | ||
} | ||
]]> | ||
</code> | ||
<code title="Invalid: using camel case to separate words."> | ||
<![CDATA[ | ||
class My_Class { | ||
public $variableName = 'value'; | ||
} | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |