code: protected function initialize()
      {
          $tagName = $this->element->getTagName();
          if ('input' !== $tagName && 'button' !== $tagName) {
              throw new \LogicException(\sprintf('An InputFormField can only be created from an input or button tag (%s given).', $tagName));
          }
  
          $type = \strtolower($this->element->getAttribute('type'));
          if ('checkbox' === $type) {
              throw new \LogicException('Checkboxes should be instances of ChoiceFormField.');
          }
  
          if ('file' === $type) {
              throw new \LogicException('File inputs should be instances of FileFormField.');
          }
      }
docs: Initializes the form field.
  
  @throws \LogicException When node type is incorrect