Skip to content

Commit 46de1e4

Browse files
committed
Fix namespace issues
1 parent 2d4bdad commit 46de1e4

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

src/Scaffold_Command.php

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22

33
use WP_CLI\Utils;
4-
use WP_CLI\Process;
54
use WP_CLI\Inflector;
65

76
/**
@@ -190,7 +189,7 @@ private function scaffold( $slug, $assoc_args, $defaults, $subdir, $templates )
190189
if ( is_string( $path ) && ! empty( $path ) ) {
191190
$filename = "{$path}{$slug}.php";
192191

193-
$force = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force' );
192+
$force = Utils\get_flag_value( $assoc_args, 'force' );
194193
$files_written = $this->create_files( array( $filename => $final_output ), $force );
195194
$skip_message = "Skipped creating '{$filename}'.";
196195
$success_message = "Created '{$filename}'.";
@@ -387,7 +386,7 @@ public function underscores( $args, $assoc_args ) {
387386
WP_CLI::error( "Invalid theme slug specified. {$error_msg}" );
388387
}
389388

390-
$force = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force' );
389+
$force = Utils\get_flag_value( $assoc_args, 'force' );
391390
$should_write_file = $this->prompt_if_files_will_be_overwritten( $_s_theme_path, $force );
392391
if ( ! $should_write_file ) {
393392
WP_CLI::log( 'No files created' );
@@ -404,11 +403,11 @@ public function underscores( $args, $assoc_args ) {
404403
$body['underscoresme_description'] = $theme_description;
405404
$body['underscoresme_generate_submit'] = 'Generate';
406405
$body['underscoresme_generate'] = '1';
407-
if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'sassify' ) ) {
406+
if ( Utils\get_flag_value( $assoc_args, 'sassify' ) ) {
408407
$body['underscoresme_sass'] = 1;
409408
}
410409

411-
if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'woocommerce' ) ) {
410+
if ( Utils\get_flag_value( $assoc_args, 'woocommerce' ) ) {
412411
$body['underscoresme_woocommerce'] = 1;
413412
}
414413

@@ -459,9 +458,9 @@ public function underscores( $args, $assoc_args ) {
459458
WP_CLI::error( "Could not decompress your theme files ('{$tmpfname}') at '{$theme_path}': {$unzip_result->get_error_message()}" );
460459
}
461460

462-
if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'activate' ) ) {
461+
if ( Utils\get_flag_value( $assoc_args, 'activate' ) ) {
463462
WP_CLI::run_command( array( 'theme', 'activate', $theme_slug ) );
464-
} elseif ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'enable-network' ) ) {
463+
} elseif ( Utils\get_flag_value( $assoc_args, 'enable-network' ) ) {
465464
WP_CLI::run_command( array( 'theme', 'enable', $theme_slug ), array( 'network' => true ) );
466465
}
467466
}
@@ -544,15 +543,15 @@ public function child_theme( $args, $assoc_args ) {
544543
$theme_functions_path => self::mustache_render( 'child_theme_functions.mustache', $data ),
545544
"{$theme_dir}/.editorconfig" => file_get_contents( self::get_template_path( '.editorconfig' ) ),
546545
);
547-
$force = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force' );
546+
$force = Utils\get_flag_value( $assoc_args, 'force' );
548547
$files_written = $this->create_files( $files_to_create, $force );
549548
$skip_message = 'All theme files were skipped.';
550549
$success_message = "Created '{$theme_dir}'.";
551550
$this->log_whether_files_written( $files_written, $skip_message, $success_message );
552551

553-
if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'activate' ) ) {
552+
if ( Utils\get_flag_value( $assoc_args, 'activate' ) ) {
554553
WP_CLI::run_command( array( 'theme', 'activate', $theme_slug ) );
555-
} elseif ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'enable-network' ) ) {
554+
} elseif ( Utils\get_flag_value( $assoc_args, 'enable-network' ) ) {
556555
WP_CLI::run_command( array( 'theme', 'enable', $theme_slug ), array( 'network' => true ) );
557556
}
558557
}
@@ -706,14 +705,14 @@ public function plugin( $args, $assoc_args ) {
706705
"{$plugin_dir}/.distignore" => self::mustache_render( 'plugin-distignore.mustache', $data ),
707706
"{$plugin_dir}/.editorconfig" => file_get_contents( self::get_template_path( '.editorconfig' ) ),
708707
);
709-
$force = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force' );
708+
$force = Utils\get_flag_value( $assoc_args, 'force' );
710709
$files_written = $this->create_files( $files_to_create, $force );
711710

712711
$skip_message = 'All plugin files were skipped.';
713712
$success_message = 'Created plugin files.';
714713
$this->log_whether_files_written( $files_written, $skip_message, $success_message );
715714

716-
if ( ! \WP_CLI\Utils\get_flag_value( $assoc_args, 'skip-tests' ) ) {
715+
if ( ! Utils\get_flag_value( $assoc_args, 'skip-tests' ) ) {
717716
$command_args = array(
718717
'dir' => $plugin_dir,
719718
'ci' => empty( $assoc_args['ci'] ) ? '' : $assoc_args['ci'],
@@ -722,9 +721,9 @@ public function plugin( $args, $assoc_args ) {
722721
WP_CLI::run_command( array( 'scaffold', 'plugin-tests', $plugin_slug ), $command_args );
723722
}
724723

725-
if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'activate' ) ) {
724+
if ( Utils\get_flag_value( $assoc_args, 'activate' ) ) {
726725
WP_CLI::run_command( array( 'plugin', 'activate', $plugin_slug ) );
727-
} elseif ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'activate-network' ) ) {
726+
} elseif ( Utils\get_flag_value( $assoc_args, 'activate-network' ) ) {
728727
WP_CLI::run_command( array( 'plugin', 'activate', $plugin_slug ), array( 'network' => true ) );
729728
}
730729
}
@@ -904,7 +903,7 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) {
904903
"{$type}_package" => $package,
905904
);
906905

907-
$force = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force' );
906+
$force = Utils\get_flag_value( $assoc_args, 'force' );
908907
$files_to_create = array(
909908
"{$tests_dir}/bootstrap.php" => self::mustache_render( "{$type}-bootstrap.mustache", $template_data ),
910909
"{$tests_dir}/test-sample.php" => self::mustache_render( "{$type}-test-sample.mustache", $template_data ),
@@ -929,7 +928,7 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) {
929928

930929
foreach ( $to_copy as $file => $dir ) {
931930
$file_name = "{$dir}/{$file}";
932-
$force = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force' );
931+
$force = Utils\get_flag_value( $assoc_args, 'force' );
933932
$should_write_file = $this->prompt_if_files_will_be_overwritten( $file_name, $force );
934933
if ( ! $should_write_file ) {
935934
continue;
@@ -1033,7 +1032,7 @@ protected function log_whether_files_written( $files_written, $skip_message, $su
10331032
* @return string|null
10341033
*/
10351034
private function extract_dashicon( $assoc_args ) {
1036-
$dashicon = \WP_CLI\Utils\get_flag_value( $assoc_args, 'dashicon' );
1035+
$dashicon = Utils\get_flag_value( $assoc_args, 'dashicon' );
10371036
if ( ! $dashicon ) {
10381037
return null;
10391038
}
@@ -1085,7 +1084,7 @@ protected function extract_args( $assoc_args, $defaults ) {
10851084
$out = array();
10861085

10871086
foreach ( $defaults as $key => $value ) {
1088-
$out[ $key ] = \WP_CLI\Utils\get_flag_value( $assoc_args, $key, $value );
1087+
$out[ $key ] = Utils\get_flag_value( $assoc_args, $key, $value );
10891088
}
10901089

10911090
return $out;

0 commit comments

Comments
 (0)