public static function sundays($year = null): array
    {
        // determine the first sunday that is inclusive of all days in the given year
        $year = ($year) ? (int) $year : Date('Y');
        $this_sunday = static::firstSundayOfYear($year);
        if ($this_sunday->format('m-d') != '01-01') {
            $this_sunday->subDays(7);
        }

        // load up the array and return
        $sundays = [];
        while ((int) $this_sunday->format('Y') <= ($year)) {
            $sundays[] = clone $this_sunday;
            $this_sunday = $this_sunday->addDays(7);
        }
        return $sundays;
    }
public static function sundays($year = null): array
    {
        // determine the first sunday that is inclusive of all days in the given year
        $year = ($year) ? (int) $year : Date('Y');
        $this_sunday = static::firstSundayOfYear($year);
        if ($this_sunday->format('m-d') != '01-01') {
            $this_sunday->subDays(7);
        }

        // load up the array and return
        $sundays = [];
        while ((int) $this_sunday->format('Y') <= ($year)) {
            $sundays[] = clone $this_sunday;
            $this_sunday = $this_sunday->addDays(7);
        }
        return $sundays;
    }
public static function sundays ( $ year = null ) : array { // determine the first sunday that is inclusive of all days in the given year $ year = ( $ year ) ? ( int ) $ year : Date ( 'Y' ) ; $ this_sunday = static :: firstSundayOfYear ( $ year ) ; if ( $ this_sunday -> format ( 'm-d' ) != '01-01' ) { $ this_sunday -> subDays ( 7 ) ; } // load up the array and return $ sundays = [ ] ; while ( ( int ) $ this_sunday -> format ( 'Y' ) <= ( $ year ) ) { $ sundays [ ] = clone $ this_sunday ; $ this_sunday = $ this_sunday -> addDays ( 7 ) ; } return $ sundays ; }
Return an array of Sundays for the provided year.

@param  int $year
@return array
Return an array of Sundays for the provided year .