Skip to content

Commit

Permalink
Merge pull request #2468 from jrfnl/feature/docs-minor-consistency-tw…
Browse files Browse the repository at this point in the history
…eaks

Documentation: various consistency fixes
  • Loading branch information
GaryJones committed Jul 26, 2024
2 parents 32fe3c4 + 0098653 commit c1fcb19
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 32 deletions.
12 changes: 6 additions & 6 deletions WordPress/Docs/Arrays/ArrayIndentationStandard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
>
<standard>
<![CDATA[
The array closing bracket indentation should line up with the start of the content on the line containing the array opener.
The array closing bracket indentation should line up with the start of the content on the line containing the array opener.
]]>
</standard>
<code_comparison>
<code title="Valid: Closing bracket lined up correctly">
<code title="Valid: Closing bracket lined up correctly.">
<![CDATA[
$args = array(
'post_id' => 22,
<em>);</em>
]]>
</code>
<code title="Invalid: Closing bracket lined up incorrectly">
<code title="Invalid: Closing bracket lined up incorrectly.">
<![CDATA[
$args = array(
'post_id' => 22,
Expand All @@ -26,11 +26,11 @@ $args = array(
</code_comparison>
<standard>
<![CDATA[
In multi-line arrays, array items should be indented by a 4-space tab for each level of nested array, so that the array visually matches its structure.
In multi-line arrays, array items should be indented by a 4-space tab for each level of nested array, so that the array visually matches its structure.
]]>
</standard>
<code_comparison>
<code title="Valid: Correctly indented array">
<code title="Valid: Correctly indented array.">
<![CDATA[
$args = array(
'post_id' => 22,
Expand Down Expand Up @@ -88,7 +88,7 @@ $args = array(
</code>
</code_comparison>
<code_comparison>
<code title="Valid: Opener and comma after closer are indented correctly">
<code title="Valid: Opener and comma after closer are indented correctly.">
<![CDATA[
$text = array(
<<<EOD
Expand Down
6 changes: 3 additions & 3 deletions WordPress/Docs/Arrays/ArrayKeySpacingRestrictionsStandard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
>
<standard>
<![CDATA[
When referring to array items, only include a space around the index if it is a variable or the key is concatenated.
When referring to array items, only include a space around the index if it is a variable or the key is concatenated.
]]>
</standard>
<code_comparison>
<code title="Valid: Correct spacing around the index keys">
<code title="Valid: Correct spacing around the index keys.">
<![CDATA[
$post = $posts<em>[ </em>$post_id<em> ]</em>;
$post_title = $post<em>[ </em>'concatenated' . $title<em> ]</em>;
Expand All @@ -18,7 +18,7 @@ $post = $posts<em>[</em>123<em>]</em>;
$post_title = $post<em>[</em>'post_title'<em>]</em>;
]]>
</code>
<code title="Invalid: Incorrect spacing around the index keys">
<code title="Invalid: Incorrect spacing around the index keys.">
<![CDATA[
$post = $posts<em>[</em>$post_id<em>]</em>;
$post_title = $post<em>[</em>'concatenated' . $title<em> ]</em>;
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Docs/Arrays/MultipleStatementAlignmentStandard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>
<standard>
<![CDATA[
When declaring arrays, there should be one space on either side of a double arrow operator used to assign a value to a key.
When declaring arrays, there should be one space on either side of a double arrow operator used to assign a value to a key.
]]>
</standard>
<code_comparison>
Expand All @@ -24,7 +24,7 @@ $bar = array( 'year'<em>=> </em>$current_year );
</code_comparison>
<standard>
<![CDATA[
In the case of a block of related assignments, it is recommended to align the arrows to promote readability.
In the case of a block of related assignments, it is recommended to align the arrows to promote readability.
]]>
</standard>
<code_comparison>
Expand Down
16 changes: 8 additions & 8 deletions WordPress/Docs/NamingConventions/PrefixAllGlobalsStandard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]]>
</standard>
<code_comparison>
<code title="Valid: Using the prefix ECPT_">
<code title="Valid: Using the prefix ECPT_.">
<![CDATA[
define( <em>'ECPT_VERSION'</em>, '1.0' );
Expand All @@ -29,7 +29,7 @@ apply_filter(
);
]]>
</code>
<code title="Invalid: non-prefixed code">
<code title="Invalid: non-prefixed code.">
<![CDATA[
define( <em>'PLUGIN_VERSION'</em>, '1.0' );
Expand All @@ -45,7 +45,7 @@ apply_filter(
</code>
</code_comparison>
<code_comparison>
<code title="Valid: Using the prefix ECPT_ in namespaced code">
<code title="Valid: Using the prefix ECPT_ in namespaced code.">
<![CDATA[
namespace <em>ECPT_Plugin\Admin</em>;
Expand All @@ -68,7 +68,7 @@ apply_filter(
);
]]>
</code>
<code title="Invalid: using a non-prefixed namespace">
<code title="Invalid: using a non-prefixed namespace.">
<![CDATA[
namespace <em>Admin</em>;
Expand All @@ -88,12 +88,12 @@ class Admin_Page {}
]]>
</standard>
<code_comparison>
<code title="Valid: Using the prefix mycoolplugin_">
<code title="Valid: Using the prefix mycoolplugin_.">
<![CDATA[
function <em>mycoolplugin_save_post()</em> {}
]]>
</code>
<code title="Invalid: Using a WordPress reserved prefix wp_">
<code title="Invalid: Using a WordPress reserved prefix wp_.">
<![CDATA[
function <em>wp_save_post()</em> {}
]]>
Expand All @@ -105,12 +105,12 @@ function <em>wp_save_post()</em> {}
]]>
</standard>
<code_comparison>
<code title="Valid: Using the distinct prefix MyPlugin">
<code title="Valid: Using the distinct prefix MyPlugin.">
<![CDATA[
interface <em>MyPluginIsCool</em> {}
]]>
</code>
<code title="Invalid: Using a two-letter prefix My">
<code title="Invalid: Using a two-letter prefix My.">
<![CDATA[
interface <em>My</em> {}
]]>
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Docs/PHP/IniSetStandard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>
<standard>
<![CDATA[
Using ini_set() and similar functions for altering PHP settings at runtime is discouraged. Changing runtime configuration might break other plugins and themes, and even WordPress itself.
Using ini_set() and similar functions for altering PHP settings at runtime is discouraged. Changing runtime configuration might break other plugins and themes, and even WordPress itself.
]]>
</standard>
<code_comparison>
Expand All @@ -22,7 +22,7 @@ ini_set( <em>'short_open_tag'</em>, 'off' );
</code_comparison>
<standard>
<![CDATA[
For some configuration values there are alternative ways available - either via WordPress native functionality of via standard PHP - to achieve the same without the risk of breaking interoperability. These alternatives are preferred.
For some configuration values there are alternative ways available - either via WordPress native functionality of via standard PHP - to achieve the same without the risk of breaking interoperability. These alternatives are preferred.
]]>
</standard>
<code_comparison>
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Docs/PHP/YodaConditionsStandard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
]]>
</standard>
<code_comparison>
<code title="Valid: The variable is placed on the right">
<code title="Valid: The variable is placed on the right.">
<![CDATA[
if ( <em>true === $the_force</em> ) {
$victorious = you_will( $be );
}
]]>
</code>
<code title="Invalid: The variable has been placed on the left">
<code title="Invalid: The variable has been placed on the left.">
<![CDATA[
if ( <em>$the_force === false</em> ) {
$victorious = you_will_not( $be );
Expand Down
6 changes: 3 additions & 3 deletions WordPress/Docs/WP/CapabilitiesStandard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>
<standard>
<![CDATA[
Capabilities passed should be valid capabilities (custom capabilities can be added in the ruleset).
Capabilities passed should be valid capabilities (custom capabilities can be added in the ruleset).
]]>
</standard>
<code_comparison>
Expand All @@ -22,7 +22,7 @@ map_meta_cap( <em>'manage_site'</em>, $user->ID );
</code_comparison>
<standard>
<![CDATA[
Always use user capabilities instead of roles.
Always use user capabilities instead of roles.
]]>
</standard>
<code_comparison>
Expand Down Expand Up @@ -51,7 +51,7 @@ add_options_page(
</code_comparison>
<standard>
<![CDATA[
Don't use deprecated capabilities.
Don't use deprecated capabilities.
]]>
</standard>
<code_comparison>
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Docs/WP/CapitalPDangitStandard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
>
<standard>
<![CDATA[
The correct spelling of "WordPress" should be used in text strings, comments and object names.
The correct spelling of "WordPress" should be used in text strings, comments and object names.
In select cases, when part of an identifier or a URL, WordPress does not have to be capitalized.
In select cases, when part of an identifier or a URL, WordPress does not have to be capitalized.
]]>
</standard>
<code_comparison>
Expand Down
2 changes: 1 addition & 1 deletion WordPress/Docs/WP/DeprecatedParametersStandard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<standard>
<![CDATA[
Please refrain from passing deprecated WordPress function parameters.
In case, you need to pass an optional parameter positioned <em>after</em> the deprecated parameter, only ever pass the default value.
In case, you need to pass an optional parameter positioned <em>after</em> the deprecated parameter, only ever pass the default value.
]]>
</standard>
<code_comparison>
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Docs/WP/PostsPerPageStandard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
>
<standard>
<![CDATA[
Using "posts_per_page" or "numberposts" with the value set to an high number opens up the potential for making requests slow if the query ends up querying thousands of posts.
Using "posts_per_page" or "numberposts" with the value set to an high number opens up the potential for making requests slow if the query ends up querying thousands of posts.
You should always fetch the lowest number possible that still gives you the number of results you find acceptable.
You should always fetch the lowest number possible that still gives you the number of results you find acceptable.
]]>
</standard>
<code_comparison>
Expand Down
6 changes: 5 additions & 1 deletion WordPress/Docs/WhiteSpace/ObjectOperatorSpacingStandard.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<documentation title="Object Operator Spacing">
<?xml version="1.0"?>
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd"
title="Object Operator Spacing"
>
<standard>
<![CDATA[
The object operators (->, ?->, ::) should not have any spaces around them, though new lines are allowed except for use with the `::class` constant.
Expand Down

0 comments on commit c1fcb19

Please sign in to comment.