Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DatePeriod::INCLUDE_END_DATE option #9220

Merged
merged 1 commit into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions stubs/Php80.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@ class DatePeriod implements IteratorAggregate
/**
* @param Start $start
* @param (Start is string ? 0|self::EXCLUDE_START_DATE : DateInterval) $interval
* @param (Start is string ? never : DateTimeInterface|positive-int) $end
* @param (Start is string ? never : (DateTimeInterface|positive-int)) $end
* @param (Start is string ? never : 0|self::EXCLUDE_START_DATE) $options
*/
public function __construct($start, $interval = 0, $end = 1, $options = 0) {}

/** @psalm-return (Start is string ? (Traversable<int, DateTime>&Iterator) : (Traversable<int, Start>&Iterator)) */
/** @psalm-return (Start is string ? Iterator<int, DateTime> : Iterator<int, Start>) */
public function getIterator(): Iterator {}
}

Expand Down
23 changes: 23 additions & 0 deletions stubs/Php82.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,27 @@ namespace {
/** @return non-empty-list<ReflectionNamedType|ReflectionIntersectionType> */
public function getTypes(): array {}
}

/**
* @psalm-immutable
*
* @template-covariant Start of string|DateTimeInterface
* @implements IteratorAggregate<int, DateTimeInterface>
*/
class DatePeriod implements IteratorAggregate
{
const EXCLUDE_START_DATE = 1;
const INCLUDE_END_DATE = 2;

/**
* @param Start $start
* @param (Start is string ? int-mask<self::EXCLUDE_START_DATE, self::INCLUDE_END_DATE> : DateInterval) $interval
* @param (Start is string ? never : (DateTimeInterface|positive-int)) $end
* @param (Start is string ? never : int-mask<self::EXCLUDE_START_DATE, self::INCLUDE_END_DATE>) $options
*/
public function __construct($start, $interval = 0, $end = 1, $options = 0) {}

/** @psalm-return (Start is string ? Iterator<int, DateTime> : Iterator<int, Start>) */
public function getIterator(): Iterator {}
}
}