-
-
Notifications
You must be signed in to change notification settings - Fork 932
Closed
@alexander-schranz
Description
Feature request
In Symfony there is the OptionResolver component which returns a Options object which is a ArrayAccess object. This is used inside symfony forms to define form options.
As the input here is already validated I want to define the Symfony Options object like an array shape e.g.:
return (new OptionsResolver()) ->setDefault('account', null) ->setNormalizer('account', fn (Options $options, ?AccountInterface $account) => $account ?: $this->accountFactory->create([])) ->setDefault('visitorList', null) ->setNormalizer( 'visitorList', function (Options $options, ?VisitorList $visitorList) { /** @var Options{account: Account} $options */ return $visitorList ?: $this->visitorListFactory->create([ 'account' => $options['account'], ]); }, );
But currently phpstan does not support this. It would be great if phpstan does support array shapes also on ArrayAccess objects.
Metadata
Metadata
Assignees
Labels
No labels