Skip to content

Commit

Permalink
Merge pull request #443 from wp-cli/fix/reuse-has_stdin-from-framework
Browse files Browse the repository at this point in the history
  • Loading branch information
schlessera authored Nov 14, 2023
2 parents e118963 + 4b1ba25 commit fde2586
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 32 deletions.
3 changes: 1 addition & 2 deletions src/Option_Command.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use WP_CLI\Entity\Utils as EntityUtils;
use WP_CLI\Formatter;
use WP_CLI\Traverser\RecursiveDataStructureTraverser;
use WP_CLI\Utils;
Expand Down Expand Up @@ -682,7 +681,7 @@ function ( $key ) {
if ( 'delete' === $action ) {
$patch_value = null;
} else {
$stdin_value = EntityUtils::has_stdin()
$stdin_value = Utils\has_stdin()
? trim( WP_CLI::get_value_from_arg_or_stdin( $args, -1 ) )
: null;

Expand Down
3 changes: 1 addition & 2 deletions src/Post_Command.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

use WP_CLI\CommandWithDBObject;
use WP_CLI\Entity\Utils as EntityUtils;
use WP_CLI\Fetchers\Post as PostFetcher;
use WP_CLI\Fetchers\User as UserFetcher;
use WP_CLI\Utils;
Expand Down Expand Up @@ -795,7 +794,7 @@ public function generate( $args, $assoc_args ) {
}

if ( Utils\get_flag_value( $assoc_args, 'post_content' ) ) {
if ( ! EntityUtils::has_stdin() ) {
if ( ! Utils\has_stdin() ) {
WP_CLI::error( 'The parameter `post_content` reads from STDIN.' );
}

Expand Down
3 changes: 1 addition & 2 deletions src/Site_Option_Command.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use WP_CLI\Entity\Utils as EntityUtils;
use WP_CLI\Formatter;
use WP_CLI\Traverser\RecursiveDataStructureTraverser;
use WP_CLI\Utils;
Expand Down Expand Up @@ -372,7 +371,7 @@ function ( $key ) {
if ( 'delete' === $action ) {
$patch_value = null;
} else {
$stdin_value = EntityUtils::has_stdin()
$stdin_value = Utils\has_stdin()
? trim( WP_CLI::get_value_from_arg_or_stdin( $args, -1 ) )
: null;
$patch_value = ! empty( $stdin_value )
Expand Down
3 changes: 1 addition & 2 deletions src/User_Command.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

use WP_CLI\CommandWithDBObject;
use WP_CLI\Entity\Utils as EntityUtils;
use WP_CLI\Fetchers\User as UserFetcher;
use WP_CLI\Formatter;
use WP_CLI\Iterators\CSV as CsvIterator;
Expand Down Expand Up @@ -964,7 +963,7 @@ public function import_csv( $args, $assoc_args ) {
WP_CLI::error( "Couldn't access remote CSV file (HTTP {$response_code} response)." );
}
} elseif ( '-' === $filename ) {
if ( ! EntityUtils::has_stdin() ) {
if ( ! Utils\has_stdin() ) {
WP_CLI::error( 'Unable to read content from STDIN.' );
}
} elseif ( ! file_exists( $filename ) ) {
Expand Down
4 changes: 2 additions & 2 deletions src/WP_CLI/CommandWithMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use Exception;
use WP_CLI;
use WP_CLI_Command;
use WP_CLI\Entity\Utils as EntityUtils;
use WP_CLI\Traverser\RecursiveDataStructureTraverser;
use WP_CLI\Utils;

/**
* Base class for WP-CLI commands that deal with metadata
Expand Down Expand Up @@ -412,7 +412,7 @@ function ( $key ) {
if ( 'delete' === $action ) {
$patch_value = null;
} else {
$stdin_value = EntityUtils::has_stdin()
$stdin_value = Utils\has_stdin()
? trim( WP_CLI::get_value_from_arg_or_stdin( $args, -1 ) )
: null;
$patch_value = ! empty( $stdin_value )
Expand Down
22 changes: 0 additions & 22 deletions src/WP_CLI/Entity/Utils.php

This file was deleted.

0 comments on commit fde2586

Please sign in to comment.