|
28 | 28 | * 4.5.2 |
29 | 29 | * |
30 | 30 | * @package wp-cli |
| 31 | + * |
| 32 | + * @phpstan-type HTTP_Response array{headers: array<string, string>, body: string, response: array{code:false|int, message: false|string}, cookies: array<string, string>, http_response: mixed} |
31 | 33 | */ |
32 | 34 | class Core_Command extends WP_CLI_Command { |
33 | 35 |
|
@@ -659,6 +661,10 @@ private static function set_multisite_defaults( $assoc_args ) { |
659 | 661 | } |
660 | 662 |
|
661 | 663 | private function do_install( $assoc_args ) { |
| 664 | + /** |
| 665 | + * @var \wpdb $wpdb |
| 666 | + */ |
| 667 | + global $wpdb; |
662 | 668 | if ( is_blog_installed() ) { |
663 | 669 | return false; |
664 | 670 | } |
@@ -710,7 +716,7 @@ function wp_new_blog_notification() { |
710 | 716 | $args['locale'] |
711 | 717 | ); |
712 | 718 |
|
713 | | - if ( ! empty( $GLOBALS['wpdb']->last_error ) ) { |
| 719 | + if ( ! empty( $wpdb->last_error ) ) { |
714 | 720 | WP_CLI::error( 'Installation produced database errors, and may have partially or completely failed.' ); |
715 | 721 | } |
716 | 722 |
|
@@ -1502,6 +1508,10 @@ private function get_updates( $assoc_args ) { |
1502 | 1508 | return []; |
1503 | 1509 | } |
1504 | 1510 |
|
| 1511 | + /** |
| 1512 | + * @var array{wp_version: string} $GLOBALS |
| 1513 | + */ |
| 1514 | + |
1505 | 1515 | $compare_version = str_replace( '-src', '', $GLOBALS['wp_version'] ); |
1506 | 1516 |
|
1507 | 1517 | $updates = [ |
@@ -1552,7 +1562,9 @@ private function get_updates( $assoc_args ) { |
1552 | 1562 | /** |
1553 | 1563 | * Sets or clears the version check error property based on an HTTP response. |
1554 | 1564 | * |
1555 | | - * @param mixed $response The HTTP response (WP_Error, array, or other). |
| 1565 | + * @param mixed|\WP_Error $response The HTTP response (WP_Error, array, or other). |
| 1566 | + * |
| 1567 | + * @phpstan-param HTTP_Response|WP_Error $response |
1556 | 1568 | */ |
1557 | 1569 | private function set_version_check_error( $response ) { |
1558 | 1570 | if ( is_wp_error( $response ) ) { |
@@ -1583,6 +1595,8 @@ private function set_version_check_error( $response ) { |
1583 | 1595 | * @param array $args HTTP request arguments. |
1584 | 1596 | * @param string $url The request URL. |
1585 | 1597 | * @return false|array|WP_Error The response, unmodified. |
| 1598 | + * |
| 1599 | + * @phpstan-param HTTP_Response|WP_Error|false $response |
1586 | 1600 | */ |
1587 | 1601 | public function capture_version_check_error( $response, $args, $url ) { |
1588 | 1602 | if ( false === strpos( $url, 'api.wordpress.org/core/version-check' ) ) { |
@@ -1610,6 +1624,8 @@ public function capture_version_check_error( $response, $args, $url ) { |
1610 | 1624 | * @param string $_class HTTP transport class name (unused). |
1611 | 1625 | * @param array $_args HTTP request arguments (unused). |
1612 | 1626 | * @param string $url URL being requested. |
| 1627 | + * |
| 1628 | + * @phpstan-param HTTP_Response|WP_Error $response |
1613 | 1629 | */ |
1614 | 1630 | public function capture_version_check_error_from_response( $response, $context, $_class, $_args, $url ) { |
1615 | 1631 | if ( false === strpos( $url, 'api.wordpress.org/core/version-check' ) ) { |
|
0 commit comments