-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
2,393 additions
and
222 deletions.
There are no files selected for viewing
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
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
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
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
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,51 @@ | ||
<?xml version="1.0"?> | ||
<documentation title="Namespace Name Depth"> | ||
<standard> | ||
<![CDATA[ | ||
A namespace name is not allowed to be more than 3 levels deep (excluding the prefix). | ||
It is recommended for the name to be two levels. | ||
For unit test files, `Tests\(Doubles\)` will be regarded as part of the prefix for this check. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: two-level namespace name declaration."> | ||
<![CDATA[ | ||
namespace Yoast\WP\Plugin\<em>Admin\Forms</em>; | ||
namespace Yoast\WP\Plugin\Tests\<em>Admin\Forms</em>; | ||
]]> | ||
</code> | ||
<code title="Invalid: four-level namespace name declaration."> | ||
<![CDATA[ | ||
namespace Yoast\WP\Plugin\<em>Admin\Forms\Type\Sub</em>; | ||
namespace Yoast\WP\Plugin\Tests\<em>Foo\Bar\Flo\Sub</em>; | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<standard> | ||
<![CDATA[ | ||
The levels in a namespace name should reflect the path to the file. | ||
The plugin specific prefix is disregarded for this check. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: namespace name reflects the path to the file."> | ||
<![CDATA[ | ||
<!-- Path to file: <em>admin/forms/</em>file.php --> | ||
<?php | ||
namespace Yoast\WP\Plugin\<em>Admin\Forms</em>; | ||
]]> | ||
</code> | ||
<code title="Invalid: namespace name does not reflect the path to the file."> | ||
<![CDATA[ | ||
<!-- Path to file: <em>admin/forms/</em>file.php --> | ||
<?php | ||
namespace Yoast\WP\Plugin\<em>Unrelated</em>; | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |
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,64 @@ | ||
<?xml version="1.0"?> | ||
<documentation title="Object Name Depth"> | ||
<standard> | ||
<![CDATA[ | ||
The name of objects - classes, interfaces, traits - declared within a namespace should consist of a maximum of three words. | ||
A partial exception is made for test, mock and double classes. These can have a `_Test`, `_Mock` or `_Double` class name suffix, which won't be counted. | ||
Note: the maximum (error) and the recommended (warning) maximum length are configurable. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: long class name in a file without a namespace."> | ||
<![CDATA[ | ||
class <em>Non_Namespaced_Long_Class_Name</em> {} | ||
]]> | ||
</code> | ||
<code title="Invalid: long class name in a namespaced file."> | ||
<![CDATA[ | ||
namespace Yoast\WP\Plugin; | ||
class <em>Namespaced_Long_Class_Name</em> {} | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<code_comparison> | ||
<code title="Valid: short class name in a namespaced file."> | ||
<![CDATA[ | ||
namespace Yoast\WP\Plugin; | ||
class <em>Short_Class_Name</em> {} | ||
]]> | ||
</code> | ||
<code title="Invalid: long class name in a namespaced file."> | ||
<![CDATA[ | ||
namespace Yoast\WP\Plugin; | ||
class <em>Namespaced_Too_Long_Class_Name</em> {} | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<code_comparison> | ||
<code title="Valid: test class in a namespaced file."> | ||
<![CDATA[ | ||
namespace Yoast\WP\Plugin\Tests; | ||
use PHPUnit\Framework\TestCase; | ||
class <em>Short_Class_Name_Test</em> | ||
extends TestCase {} | ||
]]> | ||
</code> | ||
<code title="Invalid: long test class name in a namespaced file."> | ||
<![CDATA[ | ||
namespace Yoast\WP\Plugin\Tests; | ||
use PHPUnit\Framework\TestCase; | ||
class <em>Namespaced_Too_Long_Class_Name_Test</em> | ||
extends TestCase {} | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |
Oops, something went wrong.