flow-development-collection
flow-development-collection copied to clipboard
BUG: TypeHandling does not parse indexed arrays like `array<string,Value>`
As reported in slack https://neos-project.slack.com/archives/C050KKBEB/p1741084870063309 the TypeHandling can crash when invoking a controller.
In the found example its unfortunate that flow attempts to look to deep into the framework WorkspaceName class. Which contains the following static property:
/**
* @var array<string,self>
*/
private static array $instances = [];
Typehandling fails and throws:
Exception #1315564744 in line 142 of Code/Flow_Object_Classes/Neos_Flow_Validation_ValidatorResolver.php: @var annotation of Found an invalid element type declaration. A type "'array<string,self>'" does not exist.
48 Neos\Flow\Validation\ValidatorResolver_Original::buildBaseValidatorConjunction()
47 Neos\Flow\Validation\ValidatorResolver_Original::getBaseValidatorConjunction()
46 Neos\Flow\Mvc\Controller\ActionController_Original::initializeActionMethodValidators()
45 Neos\Flow\Mvc\Controller\ActionController_Original::processRequest()
44 Neos\Flow\Mvc\Dispatcher_Original::initiateDispatchLoop()
43 Neos\Flow\Mvc\Dispatcher_Original::dispatch()
42 Neos\Neos\Controller\Backend\ModuleController_Original::indexAction()
41 Neos\Neos\Controller\Backend\ModuleController::indexAction()
Which is caused in the ValidatorResolver
https://github.com/neos/flow-development-collection/blob/7452add68a346c547f114b1f1fe2c263aae8aded/Neos.Flow/Classes/Validation/ValidatorResolver.php#L317
Adding an ignore validation tag does not work because that step is evaluated later.
Possible solutions:
- do not inspect classes that cannot have validations like other libraries
- skip the error and the validation as we cant be au pair for all var annotations -> possibly dangerous as changing
array<SomeValidatedClass>toarray<string,SomeValidatedClass>will stop the validation which is hard to spot as error. - ensure that the typehandling does parse all modern array formats (and
list) - or because
WorkspaceNameis a value object (seefromString) we dont need validation