Skip to content

Commit

Permalink
Docs: Corrections and improvements to docblocks for function and hook…
Browse files Browse the repository at this point in the history
…s relating to fatal error handling.

See #54729

Built from https://develop.svn.wordpress.org/trunk@53316


git-svn-id: http://core.svn.wordpress.org/trunk@52905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
johnbillion committed Apr 29, 2022
1 parent 98846ba commit beac960
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 19 deletions.
7 changes: 4 additions & 3 deletions wp-includes/class-wp-fatal-error-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public function handle() {
*
* @since 5.2.0
*
* @return array|null Error that was triggered, or null if no error received or if the error should not be handled.
* @return array|null Error information returned by `error_get_last()`, or null
* if none was recorded or the error should not be handled.
*/
protected function detect_error() {
$error = error_get_last();
Expand All @@ -90,7 +91,7 @@ protected function detect_error() {
*
* @since 5.2.0
*
* @param array $error Error information retrieved from error_get_last().
* @param array $error Error information retrieved from `error_get_last()`.
* @return bool Whether WordPress should handle this error.
*/
protected function should_handle_error( $error ) {
Expand All @@ -116,7 +117,7 @@ protected function should_handle_error( $error ) {
* @since 5.2.0
*
* @param bool $should_handle_error Whether the error should be handled by the fatal error handler.
* @param array $error Error information retrieved from error_get_last().
* @param array $error Error information retrieved from `error_get_last()`.
*/
return (bool) apply_filters( 'wp_should_handle_php_error', false, $error );
}
Expand Down
12 changes: 8 additions & 4 deletions wp-includes/class-wp-paused-extensions-storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public function __construct( $extension_type ) {
*
* @param string $extension Plugin or theme directory name.
* @param array $error {
* Error that was triggered.
* Error information returned by `error_get_last()`.
*
* @type string $type The error type.
* @type int $type The error type.
* @type string $file The name of the file in which the error occurred.
* @type string $line The line number in which the error occurred.
* @type int $line The line number in which the error occurred.
* @type string $message The error message.
* }
* @return bool True on success, false on failure.
Expand Down Expand Up @@ -141,7 +141,11 @@ public function get( $extension ) {
*
* @since 5.2.0
*
* @return array Associative array of extension slugs to the error recorded.
* @return array {
* Associative array of errors keyed by extension slug.
*
* @type array ...$0 Error information returned by `error_get_last()`.
* }
*/
public function get_all() {
if ( ! $this->is_api_loaded() ) {
Expand Down
32 changes: 26 additions & 6 deletions wp-includes/class-wp-recovery-mode-email-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct( WP_Recovery_Mode_Link_Service $link_service ) {
* @since 5.2.0
*
* @param int $rate_limit Number of seconds before another email can be sent.
* @param array $error Error details from {@see error_get_last()}
* @param array $error Error details from `error_get_last()`.
* @param array $extension {
* The extension that caused the error.
*
Expand Down Expand Up @@ -101,8 +101,13 @@ public function clear_rate_limit() {
* @since 5.2.0
*
* @param int $rate_limit Number of seconds before another email can be sent.
* @param array $error Error details from {@see error_get_last()}
* @param array $extension Extension that caused the error.
* @param array $error Error details from `error_get_last()`.
* @param array $extension {
* The extension that caused the error.
*
* @type string $slug The extension slug. The directory of the plugin or theme.
* @type string $type The extension type. Either 'plugin' or 'theme'.
* }
* @return bool Whether the email was sent successfully.
*/
private function send_recovery_mode_email( $rate_limit, $error, $extension ) {
Expand Down Expand Up @@ -256,7 +261,12 @@ private function get_recovery_mode_email_address() {
*
* @since 5.2.0
*
* @param array $extension The extension that caused the error.
* @param array $extension {
* The extension that caused the error.
*
* @type string $slug The extension slug. The directory of the plugin or theme.
* @type string $type The extension type. Either 'plugin' or 'theme'.
* }
* @return string Message about which extension caused the error.
*/
private function get_cause( $extension ) {
Expand Down Expand Up @@ -288,7 +298,12 @@ private function get_cause( $extension ) {
*
* @since 5.3.0
*
* @param array $extension The extension that caused the error.
* @param array $extension {
* The extension that caused the error.
*
* @type string $slug The extension slug. The directory of the plugin or theme.
* @type string $type The extension type. Either 'plugin' or 'theme'.
* }
* @return array|false A plugin array {@see get_plugins()} or `false` if no plugin was found.
*/
private function get_plugin( $extension ) {
Expand Down Expand Up @@ -317,7 +332,12 @@ private function get_plugin( $extension ) {
*
* @since 5.3.0
*
* @param array $extension The extension that caused the error.
* @param array $extension {
* The extension that caused the error.
*
* @type string $slug The extension slug. The directory of the plugin or theme.
* @type string $type The extension type. Either 'plugin' or 'theme'.
* }
* @return array An associative array of debug information.
*/
private function get_debug( $extension ) {
Expand Down
6 changes: 3 additions & 3 deletions wp-includes/class-wp-recovery-mode.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function is_initialized() {
*
* @since 5.2.0
*
* @param array $error Error details from {@see error_get_last()}
* @param array $error Error details from `error_get_last()`.
* @return true|WP_Error True if the error was handled and headers have already been sent.
* Or the request will exit to try and catch multiple errors at once.
* WP_Error if an error occurred preventing it from being handled.
Expand Down Expand Up @@ -339,7 +339,7 @@ protected function get_link_ttl() {
*
* @global array $wp_theme_directories
*
* @param array $error Error that was triggered.
* @param array $error Error details from `error_get_last()`.
* @return array|false {
* Extension details.
*
Expand Down Expand Up @@ -425,7 +425,7 @@ protected function is_network_plugin( $extension ) {
*
* @since 5.2.0
*
* @param array $error Error that was triggered.
* @param array $error Error details from `error_get_last()`.
* @return bool True if the error was stored successfully, false otherwise.
*/
protected function store_error( $error ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public function is_render_partials_request() {
* @param int $errno Error number.
* @param string $errstr Error string.
* @param string $errfile Error file.
* @param string $errline Error line.
* @param int $errline Error line.
* @return true Always true.
*/
public function handle_error( $errno, $errstr, $errfile = null, $errline = null ) {
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/error-protection.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function wp_paused_themes() {
*
* @since 5.2.0
*
* @param array $error Error details {@see error_get_last()}
* @param array $error Error details from `error_get_last()`.
* @return string Formatted error description.
*/
function wp_get_extension_error_description( $error ) {
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-beta3-53315';
$wp_version = '6.0-beta3-53316';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit beac960

Please sign in to comment.