@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function invoke($node, NodeInterface $parent): void |
28 | 28 | { |
29 | - if (! $node instanceof Node\Stmt\GroupUse || ! $parent instanceof PhpFileModelInterface) { |
|
29 | + if (!$node instanceof Node\Stmt\GroupUse || !$parent instanceof PhpFileModelInterface) { |
|
30 | 30 | throw new Exception('GroupUseNodeParser is made to parse a use group node'); |
31 | 31 | } |
32 | 32 |
@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | public function invoke($node, NodeInterface $parent): void |
55 | 55 | { |
56 | - if (! $node instanceof Node\Stmt\Trait_ || ! $parent instanceof PhpFileModelInterface) { |
|
56 | + if (!$node instanceof Node\Stmt\Trait_ || !$parent instanceof PhpFileModelInterface) { |
|
57 | 57 | throw new Exception('TraitNodeParser is made to parse a trait node'); |
58 | 58 | } |
59 | 59 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function invoke($node, NodeInterface $parent): void |
45 | 45 | { |
46 | - if (! $node instanceof Node\Stmt\Property || ! $parent instanceof TraitModelInterface) { |
|
46 | + if (!$node instanceof Node\Stmt\Property || !$parent instanceof TraitModelInterface) { |
|
47 | 47 | throw new Exception('AttributeNodeParser is made to parse a property node'); |
48 | 48 | } |
49 | 49 | $isStatic = $node->isStatic(); |
@@ -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)' |