@@ -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; |
@@ -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 | return $this->resolveInstance($id); |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | */ |
161 | 161 | private function autoResolve(string $class): object |
162 | 162 | { |
163 | - if (! class_exists($class)) { |
|
163 | + if (!class_exists($class)) { |
|
164 | 164 | throw new ContainerException(sprintf('Class "%s" does not exists.', $class)); |
165 | 165 | } |
166 | 166 | |
167 | 167 | $reflection = new \ReflectionClass($class); |
168 | 168 | |
169 | - if (! $reflection->isInstantiable()) { |
|
169 | + if (!$reflection->isInstantiable()) { |
|
170 | 170 | throw new ContainerException(sprintf('Class "%s" is not instantiable.', $class)); |
171 | 171 | } |
172 | 172 | return $this->buildInstance($reflection); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if (($constructor = $reflection->getConstructor()) === null) { |
187 | 187 | return $reflection->newInstance(); |
188 | 188 | } |
189 | - if (! $constructor->isPublic()) { |
|
189 | + if (!$constructor->isPublic()) { |
|
190 | 190 | throw new ContainerException( |
191 | 191 | sprintf('Class "%s" has no public constructor.', $reflection->getName()) |
192 | 192 | ); |
@@ -41,12 +41,12 @@ |
||
41 | 41 | $configPath = $input->getArgument('config-path'); |
42 | 42 | } |
43 | 43 | |
44 | - if (! file_exists($configPath)) { |
|
44 | + if (!file_exists($configPath)) { |
|
45 | 45 | throw new InvalidConfigException(sprintf('Config file "%s" does not exists.', $configPath)); |
46 | 46 | } |
47 | 47 | |
48 | 48 | $extension = pathinfo($configPath, PATHINFO_EXTENSION); |
49 | - if (! Validator::key($extension)->validate(static::CONSOLE_CONFIG_FACTORIES)) { |
|
49 | + if (!Validator::key($extension)->validate(static::CONSOLE_CONFIG_FACTORIES)) { |
|
50 | 50 | throw new InvalidConfigException( |
51 | 51 | sprintf('Config file "%s" must have .yml, .json or .php extension.', $configPath) |
52 | 52 | ); |
@@ -42,8 +42,7 @@ discard block |
||
42 | 42 | public function getNamespaceString(): ?string |
43 | 43 | { |
44 | 44 | return Validator::notEmpty()->validate($this->namespace) ? |
45 | - implode('\\', $this->namespace) : |
|
46 | - null; |
|
45 | + implode('\\', $this->namespace) : null; |
|
47 | 46 | } |
48 | 47 | |
49 | 48 | /** |
@@ -52,7 +51,6 @@ discard block |
||
52 | 51 | public function getNamespaceLast(): ?string |
53 | 52 | { |
54 | 53 | return Validator::notEmpty()->validate($this->namespace) ? |
55 | - $this->namespace[(count($this->namespace) - 1)] : |
|
56 | - null; |
|
54 | + $this->namespace[(count($this->namespace) - 1)] : null; |
|
57 | 55 | } |
58 | 56 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | /** |
45 | 45 | * {@inheritdoc} |
46 | 46 | */ |
47 | - public function catch(Exception $exception, string $path): void |
|
47 | + public function catch (Exception $exception, string $path): void |
|
48 | 48 | { |
49 | 49 | if ($this->config->hasIgnore()) { |
50 | 50 | $this->output->note(sprintf('On file "%s": %s', $path, $exception->getMessage())); |
@@ -23,5 +23,5 @@ |
||
23 | 23 | * |
24 | 24 | * @throws Exception If the configuration does not allow ignoring errors. |
25 | 25 | */ |
26 | - public function catch(Exception $exception, string $path): void; |
|
26 | + public function catch (Exception $exception, string $path): void; |
|
27 | 27 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | */ |
34 | 34 | public function parse(Node $node, NodeInterface $parent): NodeInterface |
35 | 35 | { |
36 | - if (! method_exists($this, 'invoke')) { |
|
36 | + if (!method_exists($this, 'invoke')) { |
|
37 | 37 | throw new NodeParserException(sprintf( |
38 | 38 | 'Class "%s" must implements method invoke described in AbstractNodeParser', |
39 | 39 | get_class($this) |