diff --git a/.distignore b/.distignore index b964b40c7..95b52fb02 100644 --- a/.distignore +++ b/.distignore @@ -6,6 +6,8 @@ .travis.yml behat.yml circle.yml +phpcs.xml.dist +phpunit.xml.dist bin/ features/ utils/ diff --git a/.gitignore b/.gitignore index ff4941991..bcf211b32 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ vendor/ *.tar.gz composer.lock *.log +phpunit.xml +phpcs.xml +.phpcs.xml diff --git a/composer.json b/composer.json index 1ab983452..c13526d3b 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "wp-cli/wp-cli": "^2" }, "require-dev": { - "wp-cli/wp-cli-tests": "^2.0.7" + "wp-cli/wp-cli-tests": "^2.1" }, "config": { "process-timeout": 7200, diff --git a/eval-command.php b/eval-command.php index fa3759336..7f607ce5f 100644 --- a/eval-command.php +++ b/eval-command.php @@ -4,9 +4,9 @@ return; } -$autoload = dirname( __FILE__ ) . '/vendor/autoload.php'; -if ( file_exists( $autoload ) ) { - require_once $autoload; +$wpcli_eval_autoloader = dirname( __FILE__ ) . '/vendor/autoload.php'; +if ( file_exists( $wpcli_eval_autoloader ) ) { + require_once $wpcli_eval_autoloader; } WP_CLI::add_command( 'eval', 'Eval_Command' ); diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 000000000..043d3ab99 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,62 @@ + + + Custom ruleset for WP-CLI eval-command + + + + + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */src/Eval(File)?_Command\.php$ + + + diff --git a/src/EvalFile_Command.php b/src/EvalFile_Command.php index e9b9ec234..07c10c425 100644 --- a/src/EvalFile_Command.php +++ b/src/EvalFile_Command.php @@ -36,10 +36,10 @@ public function __invoke( $args, $assoc_args ) { WP_CLI::get_runner()->load_wordpress(); } - self::_eval( $file, $args ); + self::execute_eval( $file, $args ); } - private static function _eval( $file, $args ) { + private static function execute_eval( $file, $args ) { if ( '-' === $file ) { eval( '?>' . file_get_contents( 'php://stdin' ) ); } else {