Skip to content
63 changes: 63 additions & 0 deletions WordPress/Docs/Files/FileNameStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0"?>
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd"
title="File Name"
>
<standard>
<![CDATA[
Filenames should be all lowercase with hyphens separating words.
]]>
</standard>
<code_comparison>
<code title="Valid: Lowercase and `-` separators.">
<![CDATA[
taxonomy<em>-</em>my<em>-</em>term.inc
<em>some</em>-<em>file</em>.inc
other<em>-</em>punctuation.inc
]]>
</code>
<code title="Invalid: Other punctuation or mixed case.">
<![CDATA[
taxonomy-my<em>_</em>term.inc
<em>Some</em>-<em>File</em>.inc
other<em>+</em>punctuation<em>#</em>.inc
]]>
</code>
</code_comparison>
<standard>
<![CDATA[
Class file names should be based on the class name with `class-` prepended.
]]>
</standard>
<code_comparison>
<code title="Valid: File name matches prefix and class.">
<![CDATA[
<em>class-bulk-updater</em>.php // For a class named `Bulk_Updater`.
]]>
</code>
<code title="Invalid: File name missing prefix or class.">
<![CDATA[
class<em>.</em>bulk-updater.php
<em>bulk-updater</em>.php
bulk-updater<em>-class</em>.php
]]>
</code>
</code_comparison>
<standard>
<![CDATA[
Non-class files in the directory `wp-includes` with a "@subpackage Template" tag should use the `-template` suffix.
]]>
</standard>
<code_comparison>
<code title="Valid: File name with proper suffix.">
<![CDATA[
general<em>-template</em>.php
]]>
</code>
<code title="Invalid: File name missing suffix.">
<![CDATA[
<em>general</em>.php
]]>
</code>
</code_comparison>
</documentation>
Loading