code: public void setCurrentPhaseId(PhaseId currentPhaseId) {
  
          if (defaultFacesContext != null) {
              defaultFacesContext.setCurrentPhaseId(currentPhaseId);
          } else if (!isCreatedFromValidFactory) {
              this.currentPhaseIdForInvalidFactoryConstruction = currentPhaseId;
          } else {
              throw new UnsupportedOperationException();
          }
  
      }
docs: <p class="changed_added_2_0">The implementation must call this method
  at the earliest possble point in time after entering into a new phase
  in the request processing lifecycle.</p>
  
  @param currentPhaseId The {@link javax.faces.event.PhaseId} for the
  current phase.
  
  @throws IllegalStateException if this method is called after
  this instance has been released
  
  @since 2.0