Skip to content

Commit

Permalink
Docs: Fix typo in a translator comment in _deprecated_class().
Browse files Browse the repository at this point in the history
Includes a few other formatting adjustments for consistency.

Follow-up to [48327], [56467], [56471].

See #58833.

git-svn-id: https://develop.svn.wordpress.org/trunk@56474 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Aug 26, 2023
1 parent 7f38f68 commit 7ed2467
Showing 1 changed file with 50 additions and 23 deletions.
73 changes: 50 additions & 23 deletions src/wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5413,9 +5413,8 @@ function absint( $maybeint ) {
/**
* Marks a function as deprecated and inform when it has been used.
*
* There is a hook {@see 'deprecated_function_run'} that will be called that can be used
* to get the backtrace up to what file and function called the deprecated
* function.
* There is a {@see 'deprecated_function_run'} hook that will be called that can be used
* to get the backtrace up to what file and function called the deprecated function.
*
* The current behavior is to trigger a user error if `WP_DEBUG` is true.
*
Expand Down Expand Up @@ -5502,11 +5501,11 @@ function _deprecated_function( $function_name, $version, $replacement = '' ) {
* Marks a constructor as deprecated and informs when it has been used.
*
* Similar to _deprecated_function(), but with different strings. Used to
* remove PHP4 style constructors.
* remove PHP4-style constructors.
*
* The current behavior is to trigger a user error if `WP_DEBUG` is true.
*
* This function is to be used in every PHP4 style constructor method that is deprecated.
* This function is to be used in every PHP4-style constructor method that is deprecated.
*
* @since 4.3.0
* @since 4.5.0 Added the `$parent_class` parameter.
Expand Down Expand Up @@ -5604,7 +5603,7 @@ function _deprecated_constructor( $class_name, $version, $parent_class = '' ) {
* The current behavior is to trigger a user error if `WP_DEBUG` is true.
*
* This function is to be used in the class constructor for every deprecated class.
* See {@see _deprecated_constructor()} for deprecating PHP4 style constructors.
* See {@see _deprecated_constructor()} for deprecating PHP4-style constructors.
*
* @since 6.4.0
*
Expand Down Expand Up @@ -5635,18 +5634,48 @@ function _deprecated_class( $class, $version, $replacement = '' ) {
*/
if ( WP_DEBUG && apply_filters( 'deprecated_class_trigger_error', true ) ) {
if ( function_exists( '__' ) ) {
if ( ! is_null( $replacement ) ) {
/* translators: 1: PHP class name, 2: version number, 3: alternative clas or function name */
trigger_error( sprintf( __( 'Class %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ), $class, $version, $replacement ), E_USER_DEPRECATED );
if ( $replacement ) {
trigger_error(
sprintf(
/* translators: 1: PHP class name, 2: Version number, 3: Alternative class or function name. */
__( 'Class %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
$class,
$version,
$replacement
),
E_USER_DEPRECATED
);
} else {
/* translators: 1: PHP class name, 2: version number */
trigger_error( sprintf( __( 'Class %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ), $class, $version ), E_USER_DEPRECATED );
trigger_error(
sprintf(
/* translators: 1: PHP class name, 2: Version number. */
__( 'Class %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
$class,
$version
),
E_USER_DEPRECATED
);
}
} else {
if ( ! is_null( $replacement ) ) {
trigger_error( sprintf( 'Class %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $class, $version, $replacement ), E_USER_DEPRECATED );
if ( $replacement ) {
trigger_error(
sprintf(
'Class %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
$class,
$version,
$replacement
),
E_USER_DEPRECATED
);
} else {
trigger_error( sprintf( 'Class %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $class, $version ), E_USER_DEPRECATED );
trigger_error(
sprintf(
'Class %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.',
$class,
$version
),
E_USER_DEPRECATED
);
}
}
}
Expand All @@ -5655,9 +5684,8 @@ function _deprecated_class( $class, $version, $replacement = '' ) {
/**
* Marks a file as deprecated and inform when it has been used.
*
* There is a hook {@see 'deprecated_file_included'} that will be called that can be used
* to get the backtrace up to what file and function included the deprecated
* file.
* There is a {@see 'deprecated_file_included'} hook that will be called that can be used
* to get the backtrace up to what file and function included the deprecated file.
*
* The current behavior is to trigger a user error if `WP_DEBUG` is true.
*
Expand Down Expand Up @@ -5750,15 +5778,15 @@ function _deprecated_file( $file, $version, $replacement = '', $message = '' ) {
* This function is to be used whenever a deprecated function argument is used.
* Before this function is called, the argument must be checked for whether it was
* used by comparing it to its default value or evaluating whether it is empty.
*
* For example:
*
* if ( ! empty( $deprecated ) ) {
* _deprecated_argument( __FUNCTION__, '3.0.0' );
* }
*
* There is a hook deprecated_argument_run that will be called that can be used
* to get the backtrace up to what file and function used the deprecated
* argument.
* There is a {@see 'deprecated_argument_run'} hook that will be called that can be used
* to get the backtrace up to what file and function used the deprecated argument.
*
* The current behavior is to trigger a user error if WP_DEBUG is true.
*
Expand Down Expand Up @@ -5911,9 +5939,8 @@ function _deprecated_hook( $hook, $version, $replacement = '', $message = '' ) {
/**
* Marks something as being incorrectly called.
*
* There is a hook {@see 'doing_it_wrong_run'} that will be called that can be used
* to get the backtrace up to what file and function called the deprecated
* function.
* There is a {@see 'doing_it_wrong_run'} hook that will be called that can be used
* to get the backtrace up to what file and function called the deprecated function.
*
* The current behavior is to trigger a user error if `WP_DEBUG` is true.
*
Expand Down

0 comments on commit 7ed2467

Please sign in to comment.