@@ -35,7 +35,7 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function doRun(InputInterface $input, OutputInterface $output) |
| 37 | 37 | { |
| 38 | - if (! $output->isQuiet()) { |
|
| 38 | + if (!$output->isQuiet()) { |
|
| 39 | 39 | $output->writeln(sprintf( |
| 40 | 40 | "phpunitgen %s by Paul Thébaud.\n\n", |
| 41 | 41 | $this->getVersion() |
@@ -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; |
@@ -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; |
@@ -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 | ); |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | $this->output->section(sprintf('Directory "%s" parsing begins.', $sourcePath)); |
| 70 | 70 | |
| 71 | 71 | // Check if source directory exists |
| 72 | - if (! $this->fileSystem->has($sourcePath) || ! $this->fileSystem->getMimetype($sourcePath) === 'directory') { |
|
| 72 | + if (!$this->fileSystem->has($sourcePath) || !$this->fileSystem->getMimetype($sourcePath) === 'directory') { |
|
| 73 | 73 | throw new ExecutorException(sprintf('The source directory "%s" does not exist.', $sourcePath)); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | public function validate(string $path): bool |
| 49 | 49 | { |
| 50 | - if (! $this->validatePath($path)) { |
|
| 50 | + if (!$this->validatePath($path)) { |
|
| 51 | 51 | return false; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | protected function validate($config): void |
| 51 | 51 | { |
| 52 | 52 | // Check that $config is an array |
| 53 | - if (! Validator::arrayType()->validate($config)) { |
|
| 53 | + if (!Validator::arrayType()->validate($config)) { |
|
| 54 | 54 | throw new InvalidConfigException('The config must be an array.'); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // Check boolean parameters |
| 58 | - if (! Validator::key('interface', Validator::boolType())->validate($config)) { |
|
| 58 | + if (!Validator::key('interface', Validator::boolType())->validate($config)) { |
|
| 59 | 59 | throw new InvalidConfigException('"interface" parameter must be set as a boolean.'); |
| 60 | 60 | } |
| 61 | - if (! Validator::key('auto', Validator::boolType())->validate($config)) { |
|
| 61 | + if (!Validator::key('auto', Validator::boolType())->validate($config)) { |
|
| 62 | 62 | throw new InvalidConfigException('"auto" parameter must be set as a boolean.'); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | private function validatePhpdoc($config): void |
| 76 | 76 | { |
| 77 | 77 | // Check that dirs key exists |
| 78 | - if (! Validator::key('phpdoc', Validator::arrayType())->validate($config)) { |
|
| 78 | + if (!Validator::key('phpdoc', Validator::arrayType())->validate($config)) { |
|
| 79 | 79 | throw new InvalidConfigException('"phpdoc" parameter is not an array.'); |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | private function validateBooleans($config): void |
| 42 | 42 | { |
| 43 | 43 | // Check boolean parameters |
| 44 | - if (! Validator::key('overwrite', Validator::boolType())->validate($config)) { |
|
| 44 | + if (!Validator::key('overwrite', Validator::boolType())->validate($config)) { |
|
| 45 | 45 | throw new InvalidConfigException('"overwrite" parameter must be set as a boolean.'); |
| 46 | 46 | } |
| 47 | - if (! Validator::key('ignore', Validator::boolType())->validate($config)) { |
|
| 47 | + if (!Validator::key('ignore', Validator::boolType())->validate($config)) { |
|
| 48 | 48 | throw new InvalidConfigException('"ignore" parameter must be set as a boolean.'); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | private function validateIncludeRegex($config): void |
| 60 | 60 | { |
| 61 | - if (! Validator::key('include', Validator::stringType())->validate($config) |
|
| 62 | - && ! Validator::key('include', Validator::nullType())->validate($config) |
|
| 61 | + if (!Validator::key('include', Validator::stringType())->validate($config) |
|
| 62 | + && !Validator::key('include', Validator::nullType())->validate($config) |
|
| 63 | 63 | ) { |
| 64 | 64 | throw new InvalidConfigException('"include" parameter must be set as a string or a null value.'); |
| 65 | 65 | } |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | private function validateExcludeRegex($config): void |
| 76 | 76 | { |
| 77 | - if (! Validator::key('exclude', Validator::stringType())->validate($config) |
|
| 78 | - && ! Validator::key('exclude', Validator::nullType())->validate($config) |
|
| 77 | + if (!Validator::key('exclude', Validator::stringType())->validate($config) |
|
| 78 | + && !Validator::key('exclude', Validator::nullType())->validate($config) |
|
| 79 | 79 | ) { |
| 80 | 80 | throw new InvalidConfigException('"exclude" parameter must be set as a string or a null value.'); |
| 81 | 81 | } |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | private function validateDirs($config): void |
| 92 | 92 | { |
| 93 | 93 | // Check that dirs key exists |
| 94 | - if (! Validator::key('dirs', Validator::arrayType())->validate($config)) { |
|
| 94 | + if (!Validator::key('dirs', Validator::arrayType())->validate($config)) { |
|
| 95 | 95 | throw new InvalidConfigException('"dirs" parameter is not an array.'); |
| 96 | 96 | } |
| 97 | 97 | // Validate each dirs |
| 98 | - if (! Validator::arrayVal() |
|
| 98 | + if (!Validator::arrayVal() |
|
| 99 | 99 | ->each(Validator::stringType(), Validator::stringType())->validate($config['dirs']) |
| 100 | 100 | ) { |
| 101 | 101 | throw new InvalidConfigException('Some directories in "dirs" parameter are not strings.'); |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | private function validateFiles($config): void |
| 113 | 113 | { |
| 114 | 114 | // Check that files key exists |
| 115 | - if (! Validator::key('files', Validator::arrayType())->validate($config)) { |
|
| 115 | + if (!Validator::key('files', Validator::arrayType())->validate($config)) { |
|
| 116 | 116 | throw new InvalidConfigException('"files" parameter is not an array.'); |
| 117 | 117 | } |
| 118 | 118 | // Validate each files |
| 119 | - if (! Validator::arrayVal() |
|
| 119 | + if (!Validator::arrayVal() |
|
| 120 | 120 | ->each(Validator::stringType(), Validator::stringType())->validate($config['files']) |
| 121 | 121 | ) { |
| 122 | 122 | throw new InvalidConfigException('Some files in "files" parameter are not strings.'); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function addDirectory(string $sourceDirectory, string $targetDirectory): void |
| 170 | 170 | { |
| 171 | - if (! Validator::arrayType()->validate($this->config['dirs'])) { |
|
| 171 | + if (!Validator::arrayType()->validate($this->config['dirs'])) { |
|
| 172 | 172 | $this->config['dirs'] = []; |
| 173 | 173 | } |
| 174 | 174 | $this->config['dirs'][$sourceDirectory] = $targetDirectory; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | public function addFile(string $sourceFile, string $targetFile): void |
| 189 | 189 | { |
| 190 | - if (! Validator::arrayType()->validate($this->config['files'])) { |
|
| 190 | + if (!Validator::arrayType()->validate($this->config['files'])) { |
|
| 191 | 191 | $this->config['files'] = []; |
| 192 | 192 | } |
| 193 | 193 | $this->config['files'][$sourceFile] = $targetFile; |