From f63c4a7b708271141ef8348859e6690c163530fb Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 7 Aug 2026 22:09:57 +0200 Subject: [PATCH 1/2] Fix newly reported PHPStan error --- src/Find_Command.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Find_Command.php b/src/Find_Command.php index 2c1b6c6..f15695a 100644 --- a/src/Find_Command.php +++ b/src/Find_Command.php @@ -213,7 +213,7 @@ static function ( $path ) { $aliases = WP_CLI::get_runner()->aliases; foreach ( $aliases as $alias => $target ) { - if ( empty( $target['path'] ) ) { + if ( ! is_array( $target ) || empty( $target['path'] ) || ! is_string( $target['path'] ) ) { continue; } $this->resolved_aliases[ rtrim( Path::normalize( $target['path'] ), '/' ) ] = $alias; From 68881fc1e4a6830b4e9324701e675bf1da96ab93 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 7 Aug 2026 22:15:00 +0200 Subject: [PATCH 2/2] Address code review feedback --- features/find.feature | 7 +++++++ src/Find_Command.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/features/find.feature b/features/find.feature index eb27edd..7eb2486 100644 --- a/features/find.feature +++ b/features/find.feature @@ -173,6 +173,13 @@ Feature: Find WordPress installs on the filesystem """ @test1: path: {TEST_DIR}/subdir2 + @invalid_empty: + path: '' + @invalid_non_string: + path: + - invalid + @invalid_group: + - @test1 """ When I run `wp find {TEST_DIR} --fields=version_path,alias` diff --git a/src/Find_Command.php b/src/Find_Command.php index f15695a..674ed18 100644 --- a/src/Find_Command.php +++ b/src/Find_Command.php @@ -213,7 +213,7 @@ static function ( $path ) { $aliases = WP_CLI::get_runner()->aliases; foreach ( $aliases as $alias => $target ) { - if ( ! is_array( $target ) || empty( $target['path'] ) || ! is_string( $target['path'] ) ) { + if ( ! is_array( $target ) || ! isset( $target['path'] ) || ! is_string( $target['path'] ) || '' === $target['path'] ) { continue; } $this->resolved_aliases[ rtrim( Path::normalize( $target['path'] ), '/' ) ] = $alias;