src/Field/MonthOfYear.php
public static function getLength(int $monthOfYear, int $year = null) : int
    {
        switch ($monthOfYear) {
            case 2:
                return ($year === null || Year::isLeap($year)) ? 29 : 28;

            case 4:
            case 6:
            case 9:
            case 11:
                return 30;

            default:
                return 31;
        }
    }
public static function getLength(int $monthOfYear, int $year = null) : int
    {
        switch ($monthOfYear) {
            case 2:
                return ($year === null || Year::isLeap($year)) ? 29 : 28;

            case 4:
            case 6:
            case 9:
            case 11:
                return 30;

            default:
                return 31;
        }
    }
public static function getLength ( int $ monthOfYear , int $ year = null ) : int { switch ( $ monthOfYear ) { case 2 : return ( $ year === null || Year :: isLeap ( $ year ) ) ? 29 : 28 ; case 4 : case 6 : case 9 : case 11 : return 30 ; default : return 31 ; } }
Returns the length of the given month-of-year.

If no year is given, the highest value (29) is returned for the month of February.

@param int      $monthOfYear The month-of-year, validated.
@param int|null $year        An optional year the month-of-year belongs to, validated.

@return int
Returns the length of the given month - of - year .