Skip to content

Commit

Permalink
Merge pull request #241 from szepeviktor/patch-2
Browse files Browse the repository at this point in the history
Return bool as WP_Scripts::do_item does
  • Loading branch information
westonruter authored Mar 25, 2020
2 parents 5b9b552 + 573d4f9 commit 6a4c0bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion wp-includes/class-wp-service-worker-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function get_all() {
*
* @param string $handle Handle.
* @param bool $group Group. Unused.
* @return void
* @return bool True on success, false on failure.
*/
public function do_item( $handle, $group = false ) {
$registered = $this->registered[ $handle ];
Expand Down Expand Up @@ -176,6 +176,8 @@ public function do_item( $handle, $group = false ) {
@_doing_it_wrong( 'WP_Service_Worker_Scripts::register', esc_html( $error ), '0.1' ); // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged, WordPress.PHP.NoSilencedErrors.Discouraged -- We want the error in the PHP log, but not in the JS output.
printf( "console.warn( %s );\n", wp_service_worker_json_encode( $error ) ); // phpcs:ignore WordPress.XSS.EscapeOutput, WordPress.Security.EscapeOutput
}

return ! $invalid;
}

/**
Expand Down

0 comments on commit 6a4c0bc

Please sign in to comment.