/**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     if (false === $options['parsley_enabled']) {
         return;
     }
     // do nothing with root form
     if (null === $form->getParent()) {
         return;
     }
     // build constraints and map them as data attributes
     // form's constraints should override entity's constraints.
     $this->constraintBuilder->configure(['constraints' => array_merge($this->getEntityConstraints($form), $this->getFormTypeConstraints($form))]);
     /** @var Constraint[] $constraints */
     $constraints = $this->constraintBuilder->build();
     foreach ($constraints as $constraint) {
         $view->vars['attr'] = array_merge($view->vars['attr'], $constraint->normalize($this->normalizer));
     }
 }
 /**
  * @param string $triggerEvent
  * @param bool $global
  *
  * @return ParsleyTypeExtension
  */
 private function createExtension($triggerEvent = 'blur', $global = true)
 {
     return new ParsleyTypeExtension($this->builder->reveal(), $this->normalizer->reveal(), $this->validator->reveal(), $global, $triggerEvent);
 }