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: 
Finally, I found a way but I'm not sure at all that it's a conventional way:

```
//...
function is_foobar($value) {
    //return true or false;
}

$resolver = new OptionsResolver();
$resolver->setRequired('data');
$resolver->setAllowedTypes('data', 'foobar');
//...

```

---

**EDIT:**

Well, after I sleep on, I think my approach is wrong, because it's already done by using `setAllowedValues` or `addAllowedValues` methods:

```
$resolver->setAllowedValues('foo', function ($value) {
    return $value instanceof Foo && $value instanceof Bar;
});

```

So it's not necessary to use `setAllowedTypes` for this purpose.
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).