Skip to content

Commit

Permalink
Clean up namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
schlessera committed Apr 22, 2019
1 parent c53af87 commit 3417708
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array" extend="true">
<element value="WP_CLI"/><!-- Namespaces. -->
<element value="wpcli"/><!-- Global variables and such. -->
<element value="WP_CLI\Shell"/><!-- Namespaces. -->
<element value="wpcli_shell"/><!-- Global variables and such. -->
</property>
</properties>
</rule>
Expand Down
18 changes: 10 additions & 8 deletions src/Shell_Command.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

class Shell_Command extends \WP_CLI_Command {
use WP_CLI\Utils;

class Shell_Command extends WP_CLI_Command {

/**
* Opens an interactive PHP console for running and testing PHP code.
Expand All @@ -26,13 +28,13 @@ class Shell_Command extends \WP_CLI_Command {
*/
public function __invoke( $_, $assoc_args ) {
$implementations = array(
'\\Psy\\Shell',
'\\Boris\\Boris',
'\\WP_CLI\\REPL',
'Psy\\Shell',
'Boris\\Boris',
'WP_CLI\\Shell\\REPL',
);

if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'basic' ) ) {
$class = '\\WP_CLI\\REPL';
if ( Utils\get_flag_value( $assoc_args, 'basic' ) ) {
$class = 'WP_CLI\\Shell\\REPL';
} else {
foreach ( $implementations as $candidate ) {
if ( class_exists( $candidate ) ) {
Expand All @@ -42,8 +44,8 @@ public function __invoke( $_, $assoc_args ) {
}
}

if ( '\\Psy\\Shell' === $class ) {
\Psy\Shell::debug();
if ( 'Psy\\Shell' === $class ) {
Psy\Shell::debug();
} else {
$repl = new $class( 'wp> ' );
$repl->start();
Expand Down
2 changes: 1 addition & 1 deletion src/WP_CLI/REPL.php → src/WP_CLI/Shell/REPL.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WP_CLI;
namespace WP_CLI\Shell;

use WP_CLI;

Expand Down

0 comments on commit 3417708

Please sign in to comment.