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

Add documentation for WordPress.NamingConventions.ValidVariableName #2457

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
39 changes: 39 additions & 0 deletions WordPress/Docs/NamingConventions/ValidVariableNameStandard.xml
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.">
richardkorthuis marked this conversation as resolved.
Show resolved Hide resolved
<![CDATA[
<em>$prefix_variable_name</em> = 'value';
]]>
</code>
<code title="Invalid: mixed case function name.">
richardkorthuis marked this conversation as resolved.
Show resolved Hide resolved
<![CDATA[
<em>$Prefix_Variable_NAME</em> = 'value';
]]>
</code>
</code_comparison>
<code_comparison>
<code title="Valid: words separated by underscores.">
richardkorthuis marked this conversation as resolved.
Show resolved Hide resolved
<![CDATA[
class My_Class {
public $variable_name = 'value';
richardkorthuis marked this conversation as resolved.
Show resolved Hide resolved
}
]]>
</code>
<code title="Invalid: using camel case to separate words.">
richardkorthuis marked this conversation as resolved.
Show resolved Hide resolved
<![CDATA[
class My_Class {
public $variableName = 'value';
richardkorthuis marked this conversation as resolved.
Show resolved Hide resolved
}
]]>
</code>
</code_comparison>
</documentation>
Loading