improve FormType::getType exception message details
This commit is contained in:
parent
39bcfd4702
commit
945f23602b
@ -84,11 +84,14 @@ class FormRegistry implements FormRegistryInterface
|
|||||||
|
|
||||||
if (!$type) {
|
if (!$type) {
|
||||||
// Support fully-qualified class names
|
// Support fully-qualified class names
|
||||||
if (class_exists($name) && in_array('Symfony\Component\Form\FormTypeInterface', class_implements($name))) {
|
if (!class_exists($name)) {
|
||||||
$type = new $name();
|
throw new InvalidArgumentException(sprintf('Could not load type "%s": class does not exist.', $name));
|
||||||
} else {
|
|
||||||
throw new InvalidArgumentException(sprintf('Could not load type "%s"', $name));
|
|
||||||
}
|
}
|
||||||
|
if (!in_array(FormTypeInterface::class, class_implements($name))) {
|
||||||
|
throw new InvalidArgumentException(sprintf('Could not load type "%s": class does not implement "%s".', $name, FormTypeInterface::class));
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = new $name();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->resolveAndAddType($type);
|
$this->resolveAndAddType($type);
|
||||||
|
Reference in New Issue
Block a user