Version: 3.0.1
Bug Description
When using Nette\Utils\Html as caption/label for input, it will fail on TypeError in validator. This code worked in 2.4

Steps To Reproduce
$label = \Nette\Utils\Html::el()->setHtml('<i>Demo</i>');
$form->addText('demo', $label)
->setRequired('Please fill in %label.');
Expected Behavior
To not throw exception and return (string) $html in %label placeholder.
Possible Solution
This fix worked for us:
+ $caption = $rule->control->getCaption();
return $rule->control instanceof Controls\BaseControl
- ? rtrim($rule->control->translate($rule->control->getCaption()), ':')
+ ? $caption instanceof Nette\Utils\Html ? $caption : rtrim($rule->control->translate($caption), ':')
: null;