@@ -44,7 +44,7 @@ |
||
| 44 | 44 | /** |
| 45 | 45 | * {@inheritdoc} |
| 46 | 46 | */ |
| 47 | - public function catch(Exception $exception): void |
|
| 47 | + public function catch (Exception $exception): void |
|
| 48 | 48 | { |
| 49 | 49 | if ($this->config->hasIgnore()) { |
| 50 | 50 | $this->output->note($exception->getMessage()); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function execute(string $sourcePath, string $targetPath): void |
| 76 | 76 | { |
| 77 | - if (! $this->fileValidator->validate($sourcePath)) { |
|
| 77 | + if (!$this->fileValidator->validate($sourcePath)) { |
|
| 78 | 78 | return; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | $targetPathExists = $this->fileSystem->has($targetPath); |
| 103 | 103 | |
| 104 | - if ($targetPathExists && ! $this->config->hasOverwrite()) { |
|
| 104 | + if ($targetPathExists && !$this->config->hasOverwrite()) { |
|
| 105 | 105 | throw new ExecutorException(sprintf('The target file "%s" already exists.', $targetPath)); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -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 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * @var Node\Stmt\Property $node The property node to parse. |
| 31 | 31 | * @var TraitModelInterface $parent The node which contains this namespace. |
| 32 | 32 | */ |
| 33 | - if (! Validator::instance(Node\Stmt\Property::class)->validate($node)) { |
|
| 33 | + if (!Validator::instance(Node\Stmt\Property::class)->validate($node)) { |
|
| 34 | 34 | return $parent; |
| 35 | 35 | } |
| 36 | 36 | foreach ($node->props as $property) { |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * @var Node\Stmt\Use_ $node The namespace node to parse. |
| 29 | 29 | * @var PhpFileModelInterface $parent The node which contains this namespace. |
| 30 | 30 | */ |
| 31 | - if (! Validator::instance(Node\Stmt\Use_::class)->validate($node)) { |
|
| 31 | + if (!Validator::instance(Node\Stmt\Use_::class)->validate($node)) { |
|
| 32 | 32 | return $parent; |
| 33 | 33 | } |
| 34 | 34 | foreach ($node->uses as $use) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | private function resolve($id): object |
| 94 | 94 | { |
| 95 | - if (! Validator::stringType()->validate($id)) { |
|
| 95 | + if (!Validator::stringType()->validate($id)) { |
|
| 96 | 96 | throw new ContainerException("Identifier is not a string."); |
| 97 | 97 | } |
| 98 | 98 | if (Validator::key($id)->validate(static::$instances)) { |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | private function autoResolve(string $class): object |
| 120 | 120 | { |
| 121 | - if (! class_exists($class)) { |
|
| 121 | + if (!class_exists($class)) { |
|
| 122 | 122 | throw new ContainerException(sprintf("Class %s does not exists.", $class)); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | $reflection = new \ReflectionClass($class); |
| 126 | 126 | |
| 127 | - if (! $reflection->isInstantiable()) { |
|
| 127 | + if (!$reflection->isInstantiable()) { |
|
| 128 | 128 | throw new ContainerException(sprintf("Class %s is not instantiable.", $class)); |
| 129 | 129 | } |
| 130 | 130 | if (($constructor = $reflection->getConstructor()) === null) { |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | private function validateBooleans($config): void |
| 41 | 41 | { |
| 42 | 42 | // Check boolean parameters |
| 43 | - if (! Validator::key('overwrite', Validator::boolType())->validate($config)) { |
|
| 43 | + if (!Validator::key('overwrite', Validator::boolType())->validate($config)) { |
|
| 44 | 44 | throw new InvalidConfigException('"overwrite" parameter must be set as a boolean.'); |
| 45 | 45 | } |
| 46 | - if (! Validator::key('auto', Validator::boolType())->validate($config)) { |
|
| 46 | + if (!Validator::key('auto', Validator::boolType())->validate($config)) { |
|
| 47 | 47 | throw new InvalidConfigException('"auto" parameter must be set as a boolean.'); |
| 48 | 48 | } |
| 49 | - if (! Validator::key('ignore', Validator::boolType())->validate($config)) { |
|
| 49 | + if (!Validator::key('ignore', Validator::boolType())->validate($config)) { |
|
| 50 | 50 | throw new InvalidConfigException('"ignore" parameter must be set as a boolean.'); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | private function validateStrings($config): void |
| 62 | 62 | { |
| 63 | 63 | // Check string parameters |
| 64 | - if (! Validator::key('include', Validator::stringType())->validate($config) || |
|
| 65 | - ! Validator::key('include', Validator::nullType())->validate($config) |
|
| 64 | + if (!Validator::key('include', Validator::stringType())->validate($config) || |
|
| 65 | + !Validator::key('include', Validator::nullType())->validate($config) |
|
| 66 | 66 | ) { |
| 67 | 67 | throw new InvalidConfigException('"include" parameter must be set as a string or a null value.'); |
| 68 | 68 | } |
| 69 | - if (! Validator::key('exclude', Validator::stringType())->validate($config) |
|
| 70 | - || ! Validator::key('exclude', Validator::nullType())->validate($config) |
|
| 69 | + if (!Validator::key('exclude', Validator::stringType())->validate($config) |
|
| 70 | + || !Validator::key('exclude', Validator::nullType())->validate($config) |
|
| 71 | 71 | ) { |
| 72 | 72 | throw new InvalidConfigException('"exclude" parameter must be set as a string or a null value.'); |
| 73 | 73 | } |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | private function validateDirs($config): void |
| 84 | 84 | { |
| 85 | 85 | // Check that dirs key exists |
| 86 | - if (! Validator::key('dirs', Validator::arrayType())->validate($config)) { |
|
| 86 | + if (!Validator::key('dirs', Validator::arrayType())->validate($config)) { |
|
| 87 | 87 | throw new InvalidConfigException('"dirs" parameter is not an array.'); |
| 88 | 88 | } |
| 89 | 89 | // Validate each dirs |
| 90 | - if (! Validator::arrayVal() |
|
| 90 | + if (!Validator::arrayVal() |
|
| 91 | 91 | ->each(Validator::stringType(), Validator::stringType())->validate($config['dirs']) |
| 92 | 92 | ) { |
| 93 | 93 | throw new InvalidConfigException('Some directories in "dirs" parameter are not strings.'); |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | private function validateFiles($config): void |
| 105 | 105 | { |
| 106 | 106 | // Check that files key exists |
| 107 | - if (! Validator::key('files', Validator::arrayType())->validate($config)) { |
|
| 107 | + if (!Validator::key('files', Validator::arrayType())->validate($config)) { |
|
| 108 | 108 | throw new InvalidConfigException('"files" parameter is not an array.'); |
| 109 | 109 | } |
| 110 | 110 | // Validate each files |
| 111 | - if (! Validator::arrayVal() |
|
| 111 | + if (!Validator::arrayVal() |
|
| 112 | 112 | ->each(Validator::stringType(), Validator::stringType())->validate($config['files']) |
| 113 | 113 | ) { |
| 114 | 114 | throw new InvalidConfigException('Some files in "files" parameter are not strings.'); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function addDirectory(string $sourceDirectory, string $targetDirectory): void |
| 162 | 162 | { |
| 163 | - if (! Validator::arrayType()->validate($this->config['dirs'])) { |
|
| 163 | + if (!Validator::arrayType()->validate($this->config['dirs'])) { |
|
| 164 | 164 | $this->config['dirs'] = []; |
| 165 | 165 | } |
| 166 | 166 | $this->config['dirs'][$sourceDirectory] = $targetDirectory; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function addFile(string $sourceFile, string $targetFile): void |
| 181 | 181 | { |
| 182 | - if (! Validator::arrayType()->validate($this->config['files'])) { |
|
| 182 | + if (!Validator::arrayType()->validate($this->config['files'])) { |
|
| 183 | 183 | $this->config['files'] = []; |
| 184 | 184 | } |
| 185 | 185 | $this->config['files'][$sourceFile] = $targetFile; |