-
Notifications
You must be signed in to change notification settings - Fork 84
Fix newly reported PHPStan issues #498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,6 +81,9 @@ abstract protected function get_item_list(); | |
| */ | ||
| abstract protected function filter_item_list( $items, $args ); | ||
|
|
||
| /** | ||
| * @return array<string, array{slug: string, name: string, update: string, recently_active?: bool, status: string, version: string}> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The keys in this PHPDoc annotation don't seem to match what the implementing methods ( * @return array<string, array{name: string, title: string, update: string, recently_active?: bool, status: string, version: string}> |
||
| */ | ||
| abstract protected function get_all_items(); | ||
|
swissspidy marked this conversation as resolved.
|
||
|
|
||
| /** | ||
|
|
@@ -237,6 +240,11 @@ public function install( $args, $assoc_args ) { | |
| && ! preg_match( '#github\.com/[^/]+/[^/]+/(?:releases/download|raw)/#', $slug ) ) { | ||
|
|
||
| $filter = function ( $source ) use ( $slug ) { | ||
| /** | ||
| * @var \WP_Filesystem_Base $wp_filesystem | ||
| */ | ||
| global $wp_filesystem; | ||
|
|
||
| /** | ||
| * @var string $path | ||
| */ | ||
|
|
@@ -255,7 +263,7 @@ public function install( $args, $assoc_args ) { | |
| } | ||
| $new_path = substr_replace( $source, $slug_dir, (int) strrpos( $source, $source_dir ), strlen( $source_dir ) ); | ||
|
|
||
| if ( $GLOBALS['wp_filesystem']->move( $source, $new_path ) ) { | ||
| if ( $wp_filesystem->move( $source, $new_path ) ) { | ||
| WP_CLI::log( sprintf( "Renamed Github-based project from '%s' to '%s'.", $source_dir, $slug_dir ) ); | ||
| return $new_path; | ||
| } | ||
|
|
@@ -874,6 +882,9 @@ protected function _search( $args, $assoc_args ) { | |
| // In older WP versions these used to be objects. | ||
| foreach ( $items as $index => $item_object ) { | ||
| if ( is_array( $item_object ) ) { | ||
| /** | ||
| * @var array{slug: string} $item_object | ||
| */ | ||
| $items[ $index ]['url'] = "https://wordpress.org/{$plural}/{$item_object['slug']}/"; | ||
| } elseif ( $item_object instanceof \stdClass ) { | ||
| $item_object->url = "https://wordpress.org/{$plural}/{$item_object->slug}/"; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.