Skip to content

Commit fc3149d

Browse files
Use array_filter for easier readability
1 parent fbc6629 commit fc3149d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/WP_CLI/ParsePluginNameInput.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ protected function check_optional_args_and_all( $args, $all, $verb = 'install',
2626

2727
if ( $all && $exclude ) {
2828
$exclude_list = explode( ',', trim( $exclude, ',' ) );
29-
foreach ( $exclude_list as $exclude_item ) {
30-
$exclude_index = array_search( $exclude_item, $args, true );
31-
if ( false !== $exclude_index ) {
32-
unset( $args[ $exclude_index ] );
29+
$args = array_filter(
30+
$args,
31+
static function( $slug ) use ( $exclude_list ) {
32+
return ! in_array( $slug, $exclude_list, true );
3333
}
34-
}
34+
);
3535
}
3636

3737
if ( empty( $args ) ) {

0 commit comments

Comments
 (0)