function beginPhase(phase) {
      if ($rootScope.$$phase) {
        throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);
      }

      $rootScope.$$phase = phase;
    }
@ngdoc method
@name form.FormController#$setValidity

@description
Change the validity state of the form, and notify the parent form (if any).

Application developers will rarely need to call this method directly. It is used internally, by
{@link ngModel.NgModelController#$setValidity NgModelController.$setValidity()}, to propagate a
control's validity state to the parent `FormController`.

@param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be
       assigned to either `$error[validationErrorKey]` or `$pending[validationErrorKey]` (for
       unfulfilled `$asyncValidators`), so that it is available for data-binding. The
       `validationErrorKey` should be in camelCase and will get converted into dash-case for
       class name. Example: `myError` will result in `ng-valid-my-error` and
       `ng-invalid-my-error` classes and can be bound to as `{{ someForm.$error.myError }}`.
@param {boolean} isValid Whether the current state is valid (true), invalid (false), pending
       (undefined),  or skipped (null). Pending is used for unfulfilled `$asyncValidators`.
       Skipped is used by AngularJS when validators do not run because of parse errors and when
       `$asyncValidators` do not run because any of the `$validators` failed.
@param {NgModelController | FormController} controller - The controller whose validity state is
       triggering the change.