@@ -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 |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | protected function validate($config): void |
57 | 57 | { |
58 | 58 | // Check that $config is an array |
59 | - if (! Validator::arrayType()->validate($config)) { |
|
59 | + if (!Validator::arrayType()->validate($config)) { |
|
60 | 60 | throw new InvalidConfigException('The config must be an array.'); |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Check boolean parameters |
64 | - if (! Validator::key('interface', Validator::boolType())->validate($config)) { |
|
64 | + if (!Validator::key('interface', Validator::boolType())->validate($config)) { |
|
65 | 65 | throw new InvalidConfigException('"interface" parameter must be set as a boolean.'); |
66 | 66 | } |
67 | - if (! Validator::key('private', Validator::boolType())->validate($config)) { |
|
67 | + if (!Validator::key('private', Validator::boolType())->validate($config)) { |
|
68 | 68 | throw new InvalidConfigException('"private" parameter must be set as a boolean.'); |
69 | 69 | } |
70 | - if (! Validator::key('auto', Validator::boolType())->validate($config)) { |
|
70 | + if (!Validator::key('auto', Validator::boolType())->validate($config)) { |
|
71 | 71 | throw new InvalidConfigException('"auto" parameter must be set as a boolean.'); |
72 | 72 | } |
73 | 73 | |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | private function validatePhpdoc($config): void |
85 | 85 | { |
86 | 86 | // Check that dirs key exists |
87 | - if (! Validator::key('phpdoc', Validator::arrayType())->validate($config)) { |
|
87 | + if (!Validator::key('phpdoc', Validator::arrayType())->validate($config)) { |
|
88 | 88 | throw new InvalidConfigException('"phpdoc" parameter is not an array.'); |
89 | 89 | } |
90 | 90 | // Validate each phpdoc |
91 | - if (! Validator::arrayVal() |
|
91 | + if (!Validator::arrayVal() |
|
92 | 92 | ->each(Validator::stringType(), Validator::stringType())->validate($config['phpdoc']) |
93 | 93 | ) { |
94 | 94 | throw new InvalidConfigException('Some annotation in "phpdoc" parameter are not strings.'); |