public function render($checked = null)
{
$this->tag->addAttribute('type', 'radio');
$nameAttribute = $this->getName();
$valueAttribute = $this->getValueAttribute(true);
$propertyValue = null;
if ($this->hasMappingErrorOccurred()) {
$propertyValue = $this->getLastSubmittedFormData();
}
if ($checked === null && $propertyValue === null) {
$propertyValue = $this->getPropertyValue();
}
if ($propertyValue !== null) {
// no type-safe comparison by intention
$checked = $propertyValue == $valueAttribute;
}
$this->registerFieldNameForFormTokenGeneration($nameAttribute);
$this->tag->addAttribute('name', $nameAttribute);
$this->tag->addAttribute('value', $valueAttribute);
if ($checked === true) {
$this->tag->addAttribute('checked', 'checked');
}
$this->addAdditionalIdentityPropertiesIfNeeded();
$this->setErrorClassAttribute();
return $this->tag->render();
}