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.ValidFunctionName #2452

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions WordPress/Docs/NamingConventions/ValidFunctionNameStandard.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 Function Name"
>
<standard>
<![CDATA[
Use lowercase letters in function names. Separate words using underscores. Do not use double underscores as a prefix.
]]>
</standard>
<code_comparison>
<code title="Valid: lowercase function name.">
<![CDATA[
function <em>prefix_function_name()</em> {}
]]>
</code>
<code title="Invalid: mixed case function name.">
<![CDATA[
function <em>Prefix_Function_NAME()</em> {}
]]>
</code>
</code_comparison>
<code_comparison>
<code title="Valid: words separated by underscores.">
<![CDATA[
class My_Class {
public static <em>method_name()</em> {}
}
]]>
</code>
<code title="Invalid: using camel case to separate words.">
<![CDATA[
class My_Class {
public static <em>methodName()</em> {}
}
]]>
</code>
</code_comparison>
</documentation>
Loading