@@ -37,7 +37,10 @@ final class ValidatorResolverOptionsRule implements Rule
3737 /** @var ValidatorClassNameResolver */
3838 private $ validatorClassNameResolver ;
3939
40- public function __construct (InitializerExprTypeResolver $ initializerExprTypeResolver , ValidatorClassNameResolver $ validatorClassNameResolver )
40+ public function __construct (
41+ InitializerExprTypeResolver $ initializerExprTypeResolver ,
42+ ValidatorClassNameResolver $ validatorClassNameResolver
43+ )
4144 {
4245 $ this ->initializerExprTypeResolver = $ initializerExprTypeResolver ;
4346 $ this ->validatorClassNameResolver = $ validatorClassNameResolver ;
@@ -88,7 +91,7 @@ public function processNode(Node $node, Scope $scope): array
8891 $ validatorObjectType = new ObjectType ($ validatorClassName );
8992 $ validatorClassReflection = $ validatorObjectType ->getClassReflection ();
9093
91- if ( ! $ validatorClassReflection instanceof ClassReflection) {
94+ if (! $ validatorClassReflection instanceof ClassReflection) {
9295 return [];
9396 }
9497
@@ -106,7 +109,8 @@ public function processNode(Node $node, Scope $scope): array
106109 $ providedOptionsArray = $ this ->extractProvidedOptions ($ validatorOptionsArgument , $ scope );
107110
108111 $ unsupportedOptions = array_diff ($ providedOptionsArray , $ validatorOptionsConfiguration ->getSupportedOptions ());
109- $ neededRequiredOptions = array_diff ($ validatorOptionsConfiguration ->getRequiredOptions (), $ providedOptionsArray );
112+ $ neededRequiredOptions
113+ = array_diff ($ validatorOptionsConfiguration ->getRequiredOptions (), $ providedOptionsArray );
110114
111115 $ errors = [];
112116
@@ -134,7 +138,7 @@ private function shouldSkip(MethodCall $methodCall, Scope $scope): bool
134138 return true ;
135139 }
136140
137- if ( ! $ methodCall ->name instanceof Node \Identifier) {
141+ if (! $ methodCall ->name instanceof Node \Identifier) {
138142 return true ;
139143 }
140144
@@ -146,22 +150,22 @@ private function shouldSkip(MethodCall $methodCall, Scope $scope): bool
146150 */
147151 private function extractProvidedOptions (?Arg $ validatorOptionsArgument , Scope $ scope ): array
148152 {
149- if ( ! $ validatorOptionsArgument instanceof Arg) {
153+ if (! $ validatorOptionsArgument instanceof Arg) {
150154 return [];
151155 }
152156
153157 $ providedOptionsArray = [];
154158
155159 $ validatorOptionsArgumentType = $ scope ->getType ($ validatorOptionsArgument ->value );
156160
157- if ( ! $ validatorOptionsArgumentType instanceof ConstantArrayType) {
161+ if (! $ validatorOptionsArgumentType instanceof ConstantArrayType) {
158162 return [];
159163 }
160164
161165 $ keysArray = $ validatorOptionsArgumentType ->getKeysArray ();
162166
163167 foreach ($ keysArray ->getValueTypes () as $ valueType ) {
164- if ( ! ($ valueType instanceof ConstantStringType)) {
168+ if (! ($ valueType instanceof ConstantStringType)) {
165169 continue ;
166170 }
167171
@@ -171,24 +175,27 @@ private function extractProvidedOptions(?Arg $validatorOptionsArgument, Scope $s
171175 return $ providedOptionsArray ;
172176 }
173177
174- private function extractValidatorOptionsConfiguration (PropertyReflection $ supportedOptions , Scope $ scope ): ValidatorOptionsConfiguration
178+ private function extractValidatorOptionsConfiguration (
179+ PropertyReflection $ supportedOptions ,
180+ Scope $ scope
181+ ): ValidatorOptionsConfiguration
175182 {
176183 $ collectedSupportedOptions = [];
177184 $ collectedRequiredOptions = [];
178185
179- if ( ! $ supportedOptions instanceof PhpPropertyReflection) {
186+ if (! $ supportedOptions instanceof PhpPropertyReflection) {
180187 return ValidatorOptionsConfiguration::empty ();
181188 }
182189
183190 $ defaultValues = $ supportedOptions ->getNativeReflection ()->getDefaultValueExpr ();
184191
185- if ( ! $ defaultValues instanceof Array_) {
192+ if (! $ defaultValues instanceof Array_) {
186193 return ValidatorOptionsConfiguration::empty ();
187194 }
188195
189196 foreach ($ defaultValues ->items as $ defaultValue ) {
190197
191- if ( ! $ defaultValue instanceof ArrayItem) {
198+ if (! $ defaultValue instanceof ArrayItem) {
192199 continue ;
193200 }
194201
@@ -205,11 +212,11 @@ private function extractValidatorOptionsConfiguration(PropertyReflection $suppor
205212 $ collectedSupportedOptions [] = $ supportedOptionKey ;
206213
207214 $ optionDefinition = $ defaultValue ->value ;
208- if ( ! $ optionDefinition instanceof Array_) {
215+ if (! $ optionDefinition instanceof Array_) {
209216 continue ;
210217 }
211218
212- if ( ! isset ($ optionDefinition ->items [3 ])) {
219+ if (! isset ($ optionDefinition ->items [3 ])) {
213220 continue ;
214221 }
215222
@@ -229,7 +236,11 @@ private function extractValidatorOptionsConfiguration(PropertyReflection $suppor
229236 return new ValidatorOptionsConfiguration ($ collectedSupportedOptions , $ collectedRequiredOptions );
230237 }
231238
232- private function resolveOptionKeyValue (ArrayItem $ defaultValue , PhpPropertyReflection $ supportedOptions , Scope $ scope ): ?string
239+ private function resolveOptionKeyValue (
240+ ArrayItem $ defaultValue ,
241+ PhpPropertyReflection $ supportedOptions ,
242+ Scope $ scope
243+ ): ?string
233244 {
234245 if ($ defaultValue ->key === null ) {
235246 return null ;
0 commit comments