OSDN Git Service

Revert "remove redundant array_filter() around preg_split()"
authorscribu <mail@scribu.net>
Tue, 30 Jul 2013 02:05:19 +0000 (05:05 +0300)
committerscribu <mail@scribu.net>
Tue, 30 Jul 2013 02:10:11 +0000 (05:10 +0300)
This reverts commit e8ea7f5b62baeb860cdc329a029d2cbc854f2d5c.

It's not redundant when the synopsis has leading or trailing whitespace
or when it's an empty string.

php/WP_CLI/SynopsisParser.php

index c28173e..d7e4c1b 100644 (file)
@@ -9,7 +9,7 @@ class SynopsisParser {
         * @return array List of parameters
         */
        static function parse( $synopsis ) {
-               $tokens = preg_split( '/[\s\t]+/', $synopsis );
+               $tokens = array_filter( preg_split( '/[\s\t]+/', $synopsis ) );
 
                $params = array();
                foreach ( $tokens as $token ) {