/**
* Initializes the type extensions.
*
* @throws UnexpectedTypeException if any registered type extension is not
* an instance of FormTypeExtensionInterface
*/
private function initTypeExtensions(): void
{ $this->typeExtensions =
[];
foreach ($this->
loadTypeExtensions() as $extension) { if (!
$extension instanceof FormTypeExtensionInterface
) { throw new UnexpectedTypeException($extension, FormTypeExtensionInterface::
class);
} foreach ($extension::
getExtendedTypes() as $extendedType) { $this->typeExtensions
[$extendedType][] =
$extension;
} } } /**
* Initializes the type guesser.
*
* @throws UnexpectedTypeException if the type guesser is not an instance of FormTypeGuesserInterface
*/