Burgov / KeyValueFormBundle

A form type for managing key-value pairs
MIT License
44 stars 32 forks source link

Remove useless IF #18

Closed lemoinem closed 8 years ago

lemoinem commented 8 years ago

This if seems dubious since both its branches are the exact same code.

It was introduced by @WouterJ while introducing support for Symfony 3.0, maybe I missed something and it IS useful...

Burgov commented 8 years ago

hm, that is strange... @WouterJ any idea where this if came from?

Burgov commented 8 years ago

I'm merging this for now since I'm not getting a response. Assuming it was probably a mistake.

wouterj commented 8 years ago

This IF is usefull, but I only copy/pasted the code instead of editing.

It should be:

if (method_exists($resolver, 'setDefined')) {
    // Symfony 2.6+ API
    $resolver->setAllowedTypes('allowed_keys', array('null', 'array'));
} else {
    // Symfony <2.6 API
    $resolver->setAllowedTypes(array('allowed_keys' => array('null', 'array')));
}

(btw, sorry for my slow response, this slipped through the mention list)

lemoinem commented 8 years ago

Thanks WouterJ for the answer! I created a PR to put the IF back and fix the compatibility