use Symfony\Component\OptionsResolver\OptionsResolver; $optionsResolver = new OptionsResolver(); $optionsResolver->setAllowedTypes('name', 'string'); $options = $optionsResolver->resolve([ 'name' => 'John', 'age' => 25, 'email' => 'john@example.com', ]); echo $options['name']; // Output: John echo $options['age']; // Output: 25 echo $options['email']; // Output: john@example.comIn this example, we set the required data type for the "name" option to "string". When we call the `resolve` method on the `$optionsResolver` object with an array of options, only the "name" option is considered valid if it is a string. All other options are accepted without any restrictions. The Symfony\Component\OptionsResolver\ OptionsResolverInterface library is part of the Symfony framework and can be installed via Composer.