2020use Evoweb \StoreFinder \Annotation \Validate ;
2121use Evoweb \StoreFinder \Validation \Validator \ConstraintValidator ;
2222use Evoweb \StoreFinder \Validation \Validator \SetPropertyNameInterface ;
23+ use Exception ;
2324use Psr \Http \Message \ServerRequestInterface ;
2425use Psr \Log \LoggerInterface ;
2526use ReflectionException ;
2627use TYPO3 \CMS \Core \Log \LogManager ;
27- use TYPO3 \CMS \Core \Utility \GeneralUtility ;
2828use TYPO3 \CMS \Extbase \Attribute as Extbase ;
2929use TYPO3 \CMS \Extbase \Mvc \Controller \Argument ;
3030use TYPO3 \CMS \Extbase \Mvc \Controller \Arguments ;
@@ -75,24 +75,25 @@ public function modifyArgumentValidators(
7575 $ this ->modifyValidatorsBasedOnSettings (
7676 $ argument ,
7777 $ request ,
78- $ settings[ ' validation ' ] ?? [] ,
78+ $ settings ,
7979 );
8080 }
8181 return $ arguments ;
8282 }
8383
8484 /**
85- * @param array<string, string|string[]> $configuredValidators
85+ * @param array<string, string|string[]> $settings
8686 */
8787 public function modifyValidatorsBasedOnSettings (
8888 Argument $ argument ,
8989 ServerRequestInterface $ request ,
90- array $ configuredValidators ,
90+ array $ settings ,
9191 ): void {
92+ $ configuredValidators = $ settings ['validation ' ] ?? [];
9293 $ parser = new DocParser ();
9394
9495 /** @var ConstraintValidator $validator */
95- $ validator = GeneralUtility:: makeInstance (ConstraintValidator::class);
96+ $ validator = $ this -> validatorResolver -> createValidator (ConstraintValidator::class);
9697 foreach ($ configuredValidators as $ fieldName => $ configuredValidator ) {
9798 if (!is_array ($ configuredValidator )) {
9899 try {
@@ -102,15 +103,13 @@ public function modifyValidatorsBasedOnSettings(
102103 $ fieldName ,
103104 $ request ,
104105 );
105- } catch (\ Exception $ exception ) {
106+ } catch (Exception $ exception ) {
106107 $ this ->logger ->debug ($ exception ->getMessage ());
107108 continue ;
108109 }
109110 } else {
110111 /** @var ConjunctionValidator $validatorInstance */
111- $ validatorInstance = $ this ->validatorResolver ->createValidator (
112- ConjunctionValidator::class
113- );
112+ $ validatorInstance = $ this ->validatorResolver ->createValidator (ConjunctionValidator::class);
114113 foreach ($ configuredValidator as $ individualConfiguredValidator ) {
115114 try {
116115 $ individualValidatorInstance = $ this ->getValidatorByConfiguration (
@@ -119,7 +118,7 @@ public function modifyValidatorsBasedOnSettings(
119118 $ fieldName ,
120119 $ request ,
121120 );
122- } catch (\ Exception $ exception ) {
121+ } catch (Exception $ exception ) {
123122 $ this ->logger ->debug ($ exception ->getMessage ());
124123 continue ;
125124 }
0 commit comments