Skip to content

Commit e907bd7

Browse files
committed
added type specifier to command factory
1 parent 4362895 commit e907bd7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/CommandFactory.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ class CommandFactory implements CommandFactoryInterface
1111
private mixed $parser;
1212
private FileReaderInterface $fileReader;
1313
private const array FORMAT_KEYS = [
14-
"stylish", "plain", "json"
14+
"stylish" => "stylish",
15+
"plain" => "plain",
16+
"json" => "json"
1517
];
1618

1719
public function __construct(
@@ -37,13 +39,13 @@ public function getCommand(string $commandType): ?CommandInterface
3739
$requestedCommand = (new FilesDiffCommand())
3840
->setFileReader($this->fileReader);
3941
break;
40-
case self::FORMAT_KEYS[0]:
42+
case self::FORMAT_KEYS["stylish"]:
4143
$requestedCommand = new StylishCommand();
4244
break;
43-
case self::FORMAT_KEYS[1]:
45+
case self::FORMAT_KEYS["plain"]:
4446
$requestedCommand = new PlainCommand();
4547
break;
46-
case self::FORMAT_KEYS[2]:
48+
case self::FORMAT_KEYS["json"]:
4749
$requestedCommand = new JSONCommand();
4850
break;
4951
case "format":

0 commit comments

Comments
 (0)