@@ -41,13 +41,13 @@ 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('backup', Validator::boolType())->validate($config)) { |
|
| 47 | + if (!Validator::key('backup', Validator::boolType())->validate($config)) { |
|
| 48 | 48 | throw new InvalidConfigException('"backup" parameter must be set as a boolean.'); |
| 49 | 49 | } |
| 50 | - if (! Validator::key('ignore', Validator::boolType())->validate($config)) { |
|
| 50 | + if (!Validator::key('ignore', Validator::boolType())->validate($config)) { |
|
| 51 | 51 | throw new InvalidConfigException('"ignore" parameter must be set as a boolean.'); |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | private function validateIncludeRegex($config): void |
| 63 | 63 | { |
| 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 | } |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | private function validateExcludeRegex($config): void |
| 79 | 79 | { |
| 80 | - if (! Validator::key('exclude', Validator::stringType())->validate($config) |
|
| 81 | - && ! Validator::key('exclude', Validator::nullType())->validate($config) |
|
| 80 | + if (!Validator::key('exclude', Validator::stringType())->validate($config) |
|
| 81 | + && !Validator::key('exclude', Validator::nullType())->validate($config) |
|
| 82 | 82 | ) { |
| 83 | 83 | throw new InvalidConfigException('"exclude" parameter must be set as a string or a null value.'); |
| 84 | 84 | } |
@@ -94,11 +94,11 @@ discard block |
||
| 94 | 94 | private function validateDirs($config): void |
| 95 | 95 | { |
| 96 | 96 | // Check that dirs key exists |
| 97 | - if (! Validator::key('dirs', Validator::arrayType())->validate($config)) { |
|
| 97 | + if (!Validator::key('dirs', Validator::arrayType())->validate($config)) { |
|
| 98 | 98 | throw new InvalidConfigException('"dirs" parameter is not an array.'); |
| 99 | 99 | } |
| 100 | 100 | // Validate each dirs |
| 101 | - if (! Validator::arrayVal() |
|
| 101 | + if (!Validator::arrayVal() |
|
| 102 | 102 | ->each(Validator::stringType(), Validator::stringType())->validate($config['dirs']) |
| 103 | 103 | ) { |
| 104 | 104 | throw new InvalidConfigException('Some directories in "dirs" parameter are not strings.'); |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | private function validateFiles($config): void |
| 116 | 116 | { |
| 117 | 117 | // Check that files key exists |
| 118 | - if (! Validator::key('files', Validator::arrayType())->validate($config)) { |
|
| 118 | + if (!Validator::key('files', Validator::arrayType())->validate($config)) { |
|
| 119 | 119 | throw new InvalidConfigException('"files" parameter is not an array.'); |
| 120 | 120 | } |
| 121 | 121 | // Validate each files |
| 122 | - if (! Validator::arrayVal() |
|
| 122 | + if (!Validator::arrayVal() |
|
| 123 | 123 | ->each(Validator::stringType(), Validator::stringType())->validate($config['files']) |
| 124 | 124 | ) { |
| 125 | 125 | throw new InvalidConfigException('Some files in "files" parameter are not strings.'); |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $phpFile = RootRetrieverHelper::getRoot($this); |
| 55 | 55 | // If class to use is not from global namespace |
| 56 | - if (! Validator::regex('/^\\\\/')->validate($decoded[0])) { |
|
| 56 | + if (!Validator::regex('/^\\\\/')->validate($decoded[0])) { |
|
| 57 | 57 | // Add the current namespace to it |
| 58 | 58 | $namespace = $phpFile->getNamespaceString(); |
| 59 | - $decoded[0] = ($namespace !== null? ($namespace . '\\') : '') . $decoded[0]; |
|
| 59 | + $decoded[0] = ($namespace !== null ? ($namespace . '\\') : '') . $decoded[0]; |
|
| 60 | 60 | } |
| 61 | 61 | // Get the last name part |
| 62 | 62 | $nameArray = explode('\\', $decoded[0]); |
@@ -77,13 +77,13 @@ discard block |
||
| 77 | 77 | private function validate($decoded): void |
| 78 | 78 | { |
| 79 | 79 | // Validate it is an array |
| 80 | - if (! Validator::arrayType()->length(2, 2)->validate($decoded)) { |
|
| 80 | + if (!Validator::arrayType()->length(2, 2)->validate($decoded)) { |
|
| 81 | 81 | throw new AnnotationParseException( |
| 82 | 82 | '"mock" annotation content is invalid (must contains the class to mock and the property name)' |
| 83 | 83 | ); |
| 84 | 84 | } |
| 85 | 85 | // Validate that each value is a string |
| 86 | - if (! Validator::arrayVal()->each(Validator::stringType(), Validator::intType())->validate($decoded)) { |
|
| 86 | + if (!Validator::arrayVal()->each(Validator::stringType(), Validator::intType())->validate($decoded)) { |
|
| 87 | 87 | throw new AnnotationParseException( |
| 88 | 88 | '"mock" annotation content is invalid (class and property name must be string)' |
| 89 | 89 | ); |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | if (Validator::stringType()->validate($decoded[$index])) { |
| 57 | 57 | $phpFile = RootRetrieverHelper::getRoot($this); |
| 58 | 58 | // If class to use is not from global namespace |
| 59 | - if (! Validator::regex('/^\\\\/')->validate($decoded[$index])) { |
|
| 59 | + if (!Validator::regex('/^\\\\/')->validate($decoded[$index])) { |
|
| 60 | 60 | // Add the current namespace to it |
| 61 | 61 | $namespace = $phpFile->getNamespaceString(); |
| 62 | - $decoded[$index] = ($namespace !== null? ($namespace . '\\') : '') . $decoded[$index]; |
|
| 62 | + $decoded[$index] = ($namespace !== null ? ($namespace . '\\') : '') . $decoded[$index]; |
|
| 63 | 63 | } |
| 64 | 64 | // Get the last name part |
| 65 | 65 | $nameArray = explode('\\', $decoded[$index]); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | private function validate($decoded): void |
| 83 | 83 | { |
| 84 | 84 | // Validate it is an array |
| 85 | - if (! Validator::arrayType()->length(1, 2)->validate($decoded)) { |
|
| 85 | + if (!Validator::arrayType()->length(1, 2)->validate($decoded)) { |
|
| 86 | 86 | throw new AnnotationParseException( |
| 87 | 87 | '"construct" annotation content is invalid (must contains parameters array, and maybe a class)' |
| 88 | 88 | ); |
@@ -91,13 +91,13 @@ discard block |
||
| 91 | 91 | $size = count($decoded); |
| 92 | 92 | |
| 93 | 93 | // Validate that if size is 2, first value is a string |
| 94 | - if ($size === 2 && ! Validator::stringType()->validate($decoded[0])) { |
|
| 94 | + if ($size === 2 && !Validator::stringType()->validate($decoded[0])) { |
|
| 95 | 95 | throw new AnnotationParseException( |
| 96 | 96 | '"construct" annotation content is invalid (constructor class must be a string)' |
| 97 | 97 | ); |
| 98 | 98 | } |
| 99 | 99 | // Validate that last value is an array |
| 100 | - if (! Validator::arrayVal() |
|
| 100 | + if (!Validator::arrayVal() |
|
| 101 | 101 | ->each(Validator::stringType(), Validator::intType())->validate($decoded[$size - 1])) { |
| 102 | 102 | throw new AnnotationParseException( |
| 103 | 103 | '"construct" annotation content is invalid (constructor parameters must be a array of string)' |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | // It is a string opening. |
| 204 | 204 | $this->openedStringToken = $type; |
| 205 | 205 | } else { |
| 206 | - if (! $this->currentlyEscaping && $type === $this->openedStringToken) { |
|
| 206 | + if (!$this->currentlyEscaping && $type === $this->openedStringToken) { |
|
| 207 | 207 | // We are in a string, the token is not escaped and is the same as the string opening token. |
| 208 | 208 | // Close the string. |
| 209 | 209 | $this->openedStringToken = null; |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | public function afterConsume(int $type): void |
| 221 | 221 | { |
| 222 | 222 | // Put in escaping mode if it were not escaping and there is a backslash token. |
| 223 | - if (! $this->currentlyEscaping && $type === AnnotationLexer::T_BACKSLASH) { |
|
| 223 | + if (!$this->currentlyEscaping && $type === AnnotationLexer::T_BACKSLASH) { |
|
| 224 | 224 | $this->currentlyEscaping = true; |
| 225 | 225 | } else { |
| 226 | 226 | $this->currentlyEscaping = false; |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | public function invoke($node, NodeInterface $parent): void |
| 49 | 49 | { |
| 50 | - if (! $node instanceof Doc || ! $parent instanceof DocumentationInterface) { |
|
| 50 | + if (!$node instanceof Doc || !$parent instanceof DocumentationInterface) { |
|
| 51 | 51 | throw new Exception('DocumentationNodeParser is made to parse a documentation node'); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | $this->output->section(sprintf('Directory "%s" parsing begins.', $sourcePath)); |
| 92 | 92 | |
| 93 | 93 | // Check if source directory exists |
| 94 | - if (! $this->fileSystem->has($sourcePath)) { |
|
| 94 | + if (!$this->fileSystem->has($sourcePath)) { |
|
| 95 | 95 | throw new FileNotFoundException(sprintf('The source directory "%s" does not exist', $sourcePath)); |
| 96 | 96 | } |
| 97 | 97 | if ($this->fileSystem->get($sourcePath)->getType() !== 'dir') { |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function invoke(string $sourcePath, string $targetPath, string $name): bool |
| 86 | 86 | { |
| 87 | - if (! $this->fileValidator->validate($sourcePath)) { |
|
| 87 | + if (!$this->fileValidator->validate($sourcePath)) { |
|
| 88 | 88 | return false; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | public function checkTargetPath(string $targetPath): void |
| 125 | 125 | { |
| 126 | 126 | if ($this->fileSystem->has($targetPath)) { |
| 127 | - if (! $this->config->hasOverwrite()) { |
|
| 127 | + if (!$this->config->hasOverwrite()) { |
|
| 128 | 128 | throw new FileExistsException(sprintf('The target file "%s" already exists', $targetPath)); |
| 129 | 129 | } |
| 130 | 130 | if ($this->config->hasBackup()) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function get($id) |
| 69 | 69 | { |
| 70 | - if (! Validator::stringType()->validate($id)) { |
|
| 70 | + if (!Validator::stringType()->validate($id)) { |
|
| 71 | 71 | throw new ContainerException('Identifier is not a string'); |
| 72 | 72 | } |
| 73 | 73 | return $this->resolveInstance($id); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | throw new ContainerException(sprintf('Class "%s" does not exists', $class)); |
| 125 | 125 | } |
| 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 | return $this->buildInstance($reflection); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function invoke($node, NodeInterface $parent): void |
| 35 | 35 | { |
| 36 | - if (! $node instanceof Node\Stmt\ClassMethod || ! $parent instanceof InterfaceModelInterface) { |
|
| 36 | + if (!$node instanceof Node\Stmt\ClassMethod || !$parent instanceof InterfaceModelInterface) { |
|
| 37 | 37 | throw new Exception('MethodNodeParser is made to parse a method node'); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $function->setVisibility(MethodVisibilityHelper::getVisibility($node)); |
| 43 | 43 | |
| 44 | 44 | // If no private / protected methods parsing is required |
| 45 | - if (! $function->isPublic() && ! $this->config->hasPrivateParsing()) { |
|
| 45 | + if (!$function->isPublic() && !$this->config->hasPrivateParsing()) { |
|
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | 48 | |