@@ -76,13 +76,13 @@ |
||
76 | 76 | */ |
77 | 77 | public function execute(string $sourcePath, string $targetPath): void |
78 | 78 | { |
79 | - if (! $this->fileValidator->validate($sourcePath)) { |
|
79 | + if (!$this->fileValidator->validate($sourcePath)) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
83 | 83 | $targetPathExists = $this->fileSystem->has($targetPath); |
84 | 84 | |
85 | - if ($targetPathExists && ! $this->config->hasOverwrite()) { |
|
85 | + if ($targetPathExists && !$this->config->hasOverwrite()) { |
|
86 | 86 | throw new ExecutorException(sprintf('The target file "%s" already exists.', $targetPath)); |
87 | 87 | } |
88 | 88 |
@@ -22,5 +22,5 @@ |
||
22 | 22 | * |
23 | 23 | * @throws Exception If the configuration does not allow ignoring errors. |
24 | 24 | */ |
25 | - public function catch(Exception $exception): void; |
|
25 | + public function catch (Exception $exception): void; |
|
26 | 26 | } |
@@ -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()); |
@@ -47,7 +47,7 @@ |
||
47 | 47 | */ |
48 | 48 | public function validate(string $path): bool |
49 | 49 | { |
50 | - if (! $this->fileSystem->has($path) |
|
50 | + if (!$this->fileSystem->has($path) |
|
51 | 51 | || $this->fileSystem->get($path)->getType() !== 'file') { |
52 | 52 | return false; |
53 | 53 | } |
@@ -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; |
@@ -52,7 +52,7 @@ |
||
52 | 52 | ) { |
53 | 53 | $this->phpParser = $phpParser; |
54 | 54 | |
55 | - $this->nodeParsers = [ |
|
55 | + $this->nodeParsers = [ |
|
56 | 56 | Node\Stmt\Namespace_::class => new NamespaceNodeParser(), |
57 | 57 | Node\Stmt\Use_::class => new UseNodeParser(), |
58 | 58 | Node\Stmt\Function_::class => null, |