static function parse( $synopsis ) {
list( $patterns, $params ) = self::get_patterns();
- $tokens = preg_split( '/[\s\t]+/', $synopsis );
+ $tokens = array_filter( preg_split( '/[\s\t]+/', $synopsis ) );
foreach ( $tokens as $token ) {
$type = false;
class SynopsisParserTest extends PHPUnit_Framework_TestCase {
+ function testEmpty() {
+ $r = SynopsisParser::parse( ' ' );
+
+ $this->assertFoundParameters( 0, 'positional', $r );
+ }
+
function testPositional() {
$r = SynopsisParser::parse( '<foo> [<bar>]' );