@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | public function invokeOneFile(string $configPath, string $sourceFile, string $targetFile): ConsoleConfigInterface |
32 | 32 | { |
33 | - if (! file_exists($sourceFile)) { |
|
33 | + if (!file_exists($sourceFile)) { |
|
34 | 34 | throw new InvalidConfigException(sprintf('The source file "%s" does not exists.', $sourceFile)); |
35 | 35 | } |
36 | 36 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | protected function decode(string $configPath): array |
22 | 22 | { |
23 | 23 | $configArray = require $configPath; |
24 | - if (! is_array($configArray)) { |
|
24 | + if (!is_array($configArray)) { |
|
25 | 25 | throw new InvalidConfigException('Unable to parse PHP config'); |
26 | 26 | } |
27 | 27 | return $configArray; |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function invokeOneFile(string $sourceFile, string $targetFile): ConsoleConfigInterface |
45 | 45 | { |
46 | - $configArray = require __DIR__ . '/../../config/default.phpunitgen.config.php'; |
|
46 | + $configArray = require __DIR__ . '/../../config/default.phpunitgen.config.php'; |
|
47 | 47 | $configArray['files'] = [ |
48 | 48 | $sourceFile => $targetFile |
49 | 49 | ]; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | protected function decode(string $configPath): array |
29 | 29 | { |
30 | 30 | $configArray = json_decode(file_get_contents($configPath), true); |
31 | - if (! Validator::arrayType()->validate($configArray)) { |
|
31 | + if (!Validator::arrayType()->validate($configArray)) { |
|
32 | 32 | throw new InvalidConfigException('Unable to parse JSON config'); |
33 | 33 | } |
34 | 34 | return $configArray; |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | private function validateBooleans($config):void |
40 | 40 | { |
41 | 41 | // Check boolean parameters |
42 | - if (! Validator::key('overwrite', Validator::boolType())->validate($config)) { |
|
42 | + if (!Validator::key('overwrite', Validator::boolType())->validate($config)) { |
|
43 | 43 | throw new InvalidConfigException('"overwrite" parameter must be set as a boolean.'); |
44 | 44 | } |
45 | - if (! Validator::key('auto', Validator::boolType())->validate($config)) { |
|
45 | + if (!Validator::key('auto', Validator::boolType())->validate($config)) { |
|
46 | 46 | throw new InvalidConfigException('"auto" parameter must be set as a boolean.'); |
47 | 47 | } |
48 | - if (! Validator::key('ignore', Validator::boolType())->validate($config)) { |
|
48 | + if (!Validator::key('ignore', Validator::boolType())->validate($config)) { |
|
49 | 49 | throw new InvalidConfigException('"ignore" parameter must be set as a boolean.'); |
50 | 50 | } |
51 | 51 | } |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | private function validateStrings($config): void |
61 | 61 | { |
62 | 62 | // Check string parameters |
63 | - if (! Validator::key('include', Validator::stringType())->validate($config)) { |
|
63 | + if (!Validator::key('include', Validator::stringType())->validate($config)) { |
|
64 | 64 | throw new InvalidConfigException('"include" parameter must be set as a string.'); |
65 | 65 | } |
66 | - if (! Validator::key('exclude', Validator::stringType())->validate($config)) { |
|
66 | + if (!Validator::key('exclude', Validator::stringType())->validate($config)) { |
|
67 | 67 | throw new InvalidConfigException('"exclude" parameter must be set as a string.'); |
68 | 68 | } |
69 | 69 | } |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | private function validateDirsAndFiles($config): void |
79 | 79 | { |
80 | 80 | // Check that dirs exists |
81 | - if (! Validator::key('dirs', Validator::arrayType())->validate($config)) { |
|
81 | + if (!Validator::key('dirs', Validator::arrayType())->validate($config)) { |
|
82 | 82 | throw new InvalidConfigException('"dirs" parameter is not an array.'); |
83 | 83 | } |
84 | - if (! Validator::key('files', Validator::arrayType())->validate($config)) { |
|
84 | + if (!Validator::key('files', Validator::arrayType())->validate($config)) { |
|
85 | 85 | throw new InvalidConfigException('"files" parameter is not an array.'); |
86 | 86 | } |
87 | 87 | // Validate each dirs |
88 | - if (! Validator::arrayVal() |
|
88 | + if (!Validator::arrayVal() |
|
89 | 89 | ->each(Validator::stringType(), Validator::stringType())->validate($config['dirs']) |
90 | 90 | ) { |
91 | 91 | throw new InvalidConfigException('Some directories in "dirs" parameter are not strings.'); |
92 | 92 | } |
93 | 93 | // Validate each dirs |
94 | - if (! Validator::arrayVal() |
|
94 | + if (!Validator::arrayVal() |
|
95 | 95 | ->each(Validator::stringType(), Validator::stringType())->validate($config['files']) |
96 | 96 | ) { |
97 | 97 | throw new InvalidConfigException('Some files in "files" parameter are not strings.'); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function addDirectory(string $sourceDirectory, string $targetDirectory): void |
145 | 145 | { |
146 | - if (! Validator::arrayType()->validate($this->config['dirs'])) { |
|
146 | + if (!Validator::arrayType()->validate($this->config['dirs'])) { |
|
147 | 147 | $this->config['dirs'] = []; |
148 | 148 | } |
149 | 149 | $this->config['dirs'][$sourceDirectory] = $targetDirectory; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function addFile(string $sourceFile, string $targetFile): void |
164 | 164 | { |
165 | - if (! Validator::arrayType()->validate($this->config['files'])) { |
|
165 | + if (!Validator::arrayType()->validate($this->config['files'])) { |
|
166 | 166 | $this->config['files'] = []; |
167 | 167 | } |
168 | 168 | $this->config['files'][$sourceFile] = $targetFile; |
@@ -54,12 +54,12 @@ |
||
54 | 54 | $sourceFile = $input->getArgument('source-file-path'); |
55 | 55 | $targetFile = $input->getArgument('target-file-path'); |
56 | 56 | |
57 | - if (! file_exists($configPath)) { |
|
57 | + if (!file_exists($configPath)) { |
|
58 | 58 | throw new InvalidConfigException(sprintf('Config file "%s" does not exists.', $configPath)); |
59 | 59 | } |
60 | 60 | |
61 | 61 | $extension = pathinfo($configPath, PATHINFO_EXTENSION); |
62 | - if (! Validator::key($extension)->validate(static::CONSOLE_CONFIG_FACTORIES)) { |
|
62 | + if (!Validator::key($extension)->validate(static::CONSOLE_CONFIG_FACTORIES)) { |
|
63 | 63 | throw new InvalidConfigException( |
64 | 64 | sprintf('Config file "%s" must have .yml, .json or .php extension.', $configPath) |
65 | 65 | ); |