Question: I dont know if I can post this here or not. But a strange thing happened recently. 

I use pycharm to run my python codes and surprisingly when I opened a piece of my code - it got deleted. The file is 0KB now - for some reason. I am using this file for over a month now and this happened when I opened it and the file automatically got deleted from pycharm and next it became 0KB.

When I tried to delete this file: 

I get the following 

Error 0xx800710FE: This file is currently not available for use on this computer

Answer: 
See [Define a form option allowed values depending on another option value in a FormType](https://stackoverflow.com/questions/35204850/define-a-form-option-allowed-values-depending-on-another-option-value-in-a-formt/35215869#35215869).

You should use a **normalizer** for this:

```
use Symfony\Component\Form\Exception\InvalidConfigurationException;

$resolver->setNormalizer('data', function(Options $options, $data) {
    if (!$data instanceof Foo && !$data instanceof Bar) {
        throw new InvalidConfigurationException('"data" option must implement "Foo" and "Bar" interfaces.');
    }

    return $data;
});

```
The signature of `OptionsResolver::setAllowedTypes()` is just [this](http://api.symfony.com/3.1/Symfony/Component/OptionsResolver/OptionsResolver.html#method_setAllowedTypes):

```
setAllowedTypes(string $option, string|string[] $allowedTypes)

```

The argument `$allowedTypes` can accept a list of strings, and is used as a logic *OR*, so *any* of those types will be allowed - that's all you can do I'm afraid...

Note that in order to allow the complex combinations you want, you'd need either more arguments or other methods, otherwise there's no way to know whether you want "any of these types", "all of these types at the same time", "any type but these ones" or any other combination you can imagine...

I guess they may provide a method that accepts a callback function as the second argument, so you can do any crazy checks you want, but *AFAIK* that doesn't exist (yet).