/** * @inheritdoc */ static function timeLineOrder() { return AbstractChronoLocalDate::timeLineOrder(); }
/** * @param int $amountToAdd * @param TemporalUnit $unit * @return static * @throws UnsupportedTemporalTypeException */ public function plus($amountToAdd, TemporalUnit $unit) { if ($unit instanceof CU) { switch ($unit) { case CU::DAYS(): return $this->plusDays($amountToAdd); case CU::WEEKS(): return $this->plusDays(Math::multiplyExact($amountToAdd, 7)); case CU::MONTHS(): return $this->plusMonths($amountToAdd); case CU::YEARS(): return $this->plusYears($amountToAdd); case CU::DECADES(): return $this->plusYears(Math::multiplyExact($amountToAdd, 10)); case CU::CENTURIES(): return $this->plusYears(Math::multiplyExact($amountToAdd, 100)); case CU::MILLENNIA(): return $this->plusYears(Math::multiplyExact($amountToAdd, 1000)); case CU::ERAS(): return $this->with(CF::ERA(), Math::addExact($this->getLong(CF::ERA()), $amountToAdd)); } throw new UnsupportedTemporalTypeException("Unsupported unit: " . $unit); } return parent::plus($amountToAdd, $unit); }