This commit is contained in:
Dylan K. Taylor
2025-10-12 19:04:04 +01:00
parent 4a3f528c4b
commit 371b991692
2 changed files with 2 additions and 13 deletions

View File

@@ -130,8 +130,8 @@ final class CommandOverload{
} }
/** /**
* @return Parameter[] * @return Parameter[]|string[]
* @phpstan-return list<Parameter> * @phpstan-return list<Parameter<*>|string>
*/ */
public function getParameters() : array{ return $this->parameters; } public function getParameters() : array{ return $this->parameters; }

View File

@@ -63,17 +63,6 @@ final class CommandStringHelper{
return $args; return $args;
} }
/**
* Splits by the same logic as {@link self::parseQuoteAware()}, but doesn't strip quotes from the parts or remove
* escapes. Useful if you need to join the parts back into a new command string.
*
* @return string[]
*/
public static function splitQuoteAware(string $commandLine) : array{
preg_match_all('/"((?:\\\\.|[^\\\\"])*)"|(\S+)/u', $commandLine, $matches);
return $matches[0];
}
public static function parseQuoteAwareSingle(string $commandLine, int &$offset = 0) : ?string{ public static function parseQuoteAwareSingle(string $commandLine, int &$offset = 0) : ?string{
//quoted or bare string, like the old CommandStringHelper //quoted or bare string, like the old CommandStringHelper
if(preg_match('/\G(?:"((?:\\\\.|[^\\\\"])*)"|(\S+))/u', $commandLine, $matches, offset: $offset) > 0){ if(preg_match('/\G(?:"((?:\\\\.|[^\\\\"])*)"|(\S+))/u', $commandLine, $matches, offset: $offset) > 0){