/** * Set activationKey. * * @param string $activationKey * * @return User */ public function storeUniqueActivationKeyForNonApprovedUser(string $activationKey) : self { if (self::STATE_APPROVED === $this->state || self::STATE_LOCKED === $this->state) { throw new \LogicException('Approved users cannot have an activation key!'); } $this->pendingActivation->setKey($activationKey); return $this; }