Ejemplo n.º 1
0
 /**
  * Validates the constructed date
  * @return void
  * @throws \InvalidArgumentException
  */
 protected function validate()
 {
     parent::validate();
     $d = $this->getDay();
     $m = $this->getMonth();
     if ($d > static::$daysInMonth[$m - 1]) {
         if (!($m == 2 && $d == 29 && static::isLeapYear($this->getYear()))) {
             throw new InvalidArgumentException();
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Validates the constructed date.
  *
  * @throws InvalidDateException
  */
 protected function validate()
 {
     parent::validate();
     $d = $this->getDay();
     $m = $this->getMonth();
     if ($d > static::$daysInMonth[$m - 1]) {
         if (!($m == 12 && $d == 30 && $this->isInLeapYear())) {
             throw new InvalidDateException($this);
         }
     }
 }