Skip to content

Commit

Permalink
New error handling Deprecated Classes and Functions (#1729)
Browse files Browse the repository at this point in the history
New error handling Deprecated Classes and Functions

Co-authored-by: Juliette <[email protected]>
  • Loading branch information
GaryJones and jrfnl authored Sep 22, 2019
2 parents 2f396d1 + dda05c1 commit 81a7fb2
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
19 changes: 19 additions & 0 deletions WordPress/Docs/WP/DeprecatedClassesStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<documentation title="Deprecated Classes">
<standard>
<![CDATA[
Please refrain from using deprecated WordPress classes.
]]>
</standard>
<code_comparison>
<code title="Valid: use of a current (non-deprecated) class.">
<![CDATA[
$a = new <em>WP_User_Query</em>();
]]>
</code>
<code title="Invalid: use of a deprecated class.">
<![CDATA[
$a = new <em>WP_User_Search</em>(); // Deprecated WP 3.1.
]]>
</code>
</code_comparison>
</documentation>
19 changes: 19 additions & 0 deletions WordPress/Docs/WP/DeprecatedFunctionsStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<documentation title="Deprecated Functions">
<standard>
<![CDATA[
Please refrain from using deprecated WordPress functions.
]]>
</standard>
<code_comparison>
<code title="Valid: use of a current (non-deprecated) function.">
<![CDATA[
$sites = <em>get_sites</em>();
]]>
</code>
<code title="Invalid: use of a deprecated function.">
<![CDATA[
$sites = <em>wp_get_sites</em>(); // Deprecated WP 4.6.
]]>
</code>
</code_comparison>
</documentation>
19 changes: 19 additions & 0 deletions WordPress/Docs/WP/DeprecatedParameterValuesStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<documentation title="Deprecated Function Parameter Values">
<standard>
<![CDATA[
Please refrain from using deprecated WordPress function parameter values.
]]>
</standard>
<code_comparison>
<code title="Valid: passing a valid function parameter value.">
<![CDATA[
bloginfo( <em>'url'</em> );
]]>
</code>
<code title="Invalid: passing a deprecated function parameter value.">
<![CDATA[
bloginfo ( <em>'home'</em> ); // Deprecated WP 2.2.0.
]]>
</code>
</code_comparison>
</documentation>
36 changes: 36 additions & 0 deletions WordPress/Docs/WP/DeprecatedParametersStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<documentation title="Deprecated Function Parameters">
<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.
]]>
</standard>
<code_comparison>
<code title="Valid: not passing a deprecated parameter.">
<![CDATA[
// First - and only - parameter deprecated.
get_the_author();
]]>
</code>
<code title="Invalid: passing a deprecated parameter.">
<![CDATA[
// First - and only - parameter deprecated.
get_the_author( <em>$string</em> );
]]>
</code>
</code_comparison>
<code_comparison>
<code title="Valid: passing default value for a deprecated parameter.">
<![CDATA[
// Third parameter deprecated in WP 2.3.0.
add_option( 'option_name', 123, <em>''</em>, 'yes' );
]]>
</code>
<code title="Invalid: not passing the default value for a deprecated parameter.">
<![CDATA[
// Third parameter deprecated in WP 2.3.0.
add_option( 'my_name', 123, <em>'oops'</em>, 'yes' );
]]>
</code>
</code_comparison>
</documentation>

0 comments on commit 81a7fb2

Please sign in to comment.