@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function get($id): object |
| 56 | 56 | { |
| 57 | - if (! is_string($id)) { |
|
| 57 | + if (!is_string($id)) { |
|
| 58 | 58 | throw new ContainerException('Given identifier to container is not a string.'); |
| 59 | 59 | } |
| 60 | 60 | if (isset($this->instances[$id])) { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function has($id): bool |
| 73 | 73 | { |
| 74 | - if (! is_string($id)) { |
|
| 74 | + if (!is_string($id)) { |
|
| 75 | 75 | return false; |
| 76 | 76 | } |
| 77 | 77 | if (isset($this->instances[$id])) { |
@@ -33,11 +33,11 @@ |
||
| 33 | 33 | |
| 34 | 34 | $container->setInstance(Parser::class, (new ParserFactory())->create(ParserFactory::PREFER_PHP7)); |
| 35 | 35 | |
| 36 | - $container->setResolver(PhpFileParserInterface::class, function (ContainerInterface $container) { |
|
| 36 | + $container->setResolver(PhpFileParserInterface::class, function(ContainerInterface $container) { |
|
| 37 | 37 | return new PhpFileParser($container->get(Parser::class)); |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | - $container->setResolver(DirectoryParserInterface::class, function (ContainerInterface $container) { |
|
| 40 | + $container->setResolver(DirectoryParserInterface::class, function(ContainerInterface $container) { |
|
| 41 | 41 | return new DirectoryParser( |
| 42 | 42 | $container->get(ConfigInterface::class), |
| 43 | 43 | $container->get(FilesystemInterface::class), |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | /** |
| 17 | 17 | * @var null UNKNOWN If the visibility is unknown. |
| 18 | 18 | */ |
| 19 | - const UNKNOWN = null; |
|
| 19 | + const UNKNOWN = null; |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * @var int PUBLIC A public visibility. |
| 23 | 23 | */ |
| 24 | - const PUBLIC = 1; |
|
| 24 | + const PUBLIC = 1; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * @var int PUBLIC A protected visibility. |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * @var int PUBLIC A private visibility. |
| 33 | 33 | */ |
| 34 | - const PRIVATE = 3; |
|
| 34 | + const PRIVATE = 3; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @param int|null $visibility The new visibility to set. |
@@ -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() |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $config = json_decode($config, true); |
| 24 | 24 | |
| 25 | - if (! is_array($config)) { |
|
| 25 | + if (!is_array($config)) { |
|
| 26 | 26 | throw new InvalidConfigException('Unable to parse JSON config'); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -43,12 +43,12 @@ |
||
| 43 | 43 | protected function validate($config): void |
| 44 | 44 | { |
| 45 | 45 | // Check that $config is an array |
| 46 | - if (! Validator::arrayType()->validate($config)) { |
|
| 46 | + if (!Validator::arrayType()->validate($config)) { |
|
| 47 | 47 | throw new InvalidConfigException('The config must be an array.'); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // Check boolean parameters |
| 51 | - if (! Validator::key('interface', Validator::boolType())->validate($config)) { |
|
| 51 | + if (!Validator::key('interface', Validator::boolType())->validate($config)) { |
|
| 52 | 52 | throw new InvalidConfigException('"interface" parameter must be set as a boolean.'); |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $sourceDirectory, |
| 102 | 102 | $exception->getMessage() |
| 103 | 103 | )); |
| 104 | - if (! $config->hasIgnore()) { |
|
| 104 | + if (!$config->hasIgnore()) { |
|
| 105 | 105 | return -1; |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function getConfiguration(string $path): ConsoleConfigInterface |
| 123 | 123 | { |
| 124 | - if (! $this->fileSystem->has($path)) { |
|
| 124 | + if (!$this->fileSystem->has($path)) { |
|
| 125 | 125 | throw new InvalidConfigException(sprintf('Config file "%s" does not exists.', $path)); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | private function validateBooleans($config):void |
| 39 | 39 | { |
| 40 | 40 | // Check boolean parameters |
| 41 | - if (! Validator::key('overwrite', Validator::boolType())->validate($config)) { |
|
| 41 | + if (!Validator::key('overwrite', Validator::boolType())->validate($config)) { |
|
| 42 | 42 | throw new InvalidConfigException('"overwrite" parameter must be set as a boolean.'); |
| 43 | 43 | } |
| 44 | - if (! Validator::key('auto', Validator::boolType())->validate($config)) { |
|
| 44 | + if (!Validator::key('auto', Validator::boolType())->validate($config)) { |
|
| 45 | 45 | throw new InvalidConfigException('"auto" 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 | } |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | private function validateStrings($config): void |
| 60 | 60 | { |
| 61 | 61 | // Check string parameters |
| 62 | - if (! Validator::key('include', Validator::stringType())->validate($config)) { |
|
| 62 | + if (!Validator::key('include', Validator::stringType())->validate($config)) { |
|
| 63 | 63 | throw new InvalidConfigException('"include" parameter must be set as a string.'); |
| 64 | 64 | } |
| 65 | - if (! Validator::key('exclude', Validator::stringType())->validate($config)) { |
|
| 65 | + if (!Validator::key('exclude', Validator::stringType())->validate($config)) { |
|
| 66 | 66 | throw new InvalidConfigException('"exclude" parameter must be set as a string.'); |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | private function validateDirs($config): void |
| 78 | 78 | { |
| 79 | 79 | // Check that dirs exists |
| 80 | - if (! Validator::key('dirs', Validator::arrayType()->length(1, null))->validate($config)) { |
|
| 80 | + if (!Validator::key('dirs', Validator::arrayType()->length(1, null))->validate($config)) { |
|
| 81 | 81 | throw new InvalidConfigException('"dirs" parameter is not an array or does not contains elements.'); |
| 82 | 82 | } |
| 83 | 83 | // Validate each dirs |
| 84 | - if (! Validator::arrayVal() |
|
| 84 | + if (!Validator::arrayVal() |
|
| 85 | 85 | ->each(Validator::stringType(), Validator::stringType())->validate($config['dirs']) |
| 86 | 86 | ) { |
| 87 | 87 | throw new InvalidConfigException('Some directories in "dirs" parameter are not strings.'); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function parse(string $sourceDirectory, string $targetDirectory): DirectoryModelInterface |
| 71 | 71 | { |
| 72 | - if (! $this->fileSystem->has($sourceDirectory) || ! $this->fileSystem->getMimetype($sourceDirectory) === 'directory') { |
|
| 72 | + if (!$this->fileSystem->has($sourceDirectory) || !$this->fileSystem->getMimetype($sourceDirectory) === 'directory') { |
|
| 73 | 73 | throw new ParsingException(sprintf('The source directory "%s" does not exist.', $sourceDirectory)); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $directoryModel->addPhpFile($this->phpFileParser->parse($this->fileSystem->read($file['path']))); |
| 100 | 100 | } |
| 101 | 101 | } catch (ParsingException $exception) { |
| 102 | - if (! $this->config->hasIgnore()) { |
|
| 102 | + if (!$this->config->hasIgnore()) { |
|
| 103 | 103 | throw new ParsingException($exception->getMessage()); |
| 104 | 104 | } |
| 105 | 105 | $this->output->writeln(sprintf('<error>%s</error>', $exception->getMessage())); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | private function validateFile(string $type, string $path): bool |
| 123 | 123 | { |
| 124 | - if (! $type === 'file' |
|
| 124 | + if (!$type === 'file' |
|
| 125 | 125 | || Validator::regex($this->config->getIncludeRegex())->validate($path) !== true |
| 126 | 126 | || Validator::regex($this->config->getExcludeRegex())->validate($path) !== false |
| 127 | 127 | ) { |