-
-
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 (#…
…2457) * Add documentation for WordPress.NamingConventions.ValidVariableName --------- Co-authored-by: Juliette <[email protected]>
- Loading branch information
1 parent
c028f32
commit eb39475
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
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,43 @@ | ||
<?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'; | ||
echo <em>$prefix_variable_name</em>; | ||
]]> | ||
</code> | ||
<code title="Invalid: Mixed case function name."> | ||
<![CDATA[ | ||
<em>$Prefix_Variable_NAME</em> = 'value'; | ||
echo <em>$Prefix_Variable_NAME</em>; | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<code_comparison> | ||
<code title="Valid: Words separated by underscores."> | ||
<![CDATA[ | ||
class My_Class { | ||
public <em>$property_name</em> = 'value'; | ||
} | ||
]]> | ||
</code> | ||
<code title="Invalid: Using camel case to separate words."> | ||
<![CDATA[ | ||
class My_Class { | ||
public <em>$propertyName</em> = 'value'; | ||
} | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |