Skip to content

Commit 5798029

Browse files
committed
[Console] improve regex performance to validate name
using possesive quantifier
1 parent 22b09ce commit 5798029

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Console/Command/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ public function asXml($asDom = false)
615615
*/
616616
private function validateName($name)
617617
{
618-
if (!preg_match('/^[^\:]+(\:[^\:]+)*$/', $name)) {
618+
if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
619619
throw new \InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
620620
}
621621
}

0 commit comments

Comments
 (0)