> > > I'm going to nitpick on the newly suggested names and argument order > for > > > the > > > DatePeriod factory methods — althoughI do agree that they need to get > > > created: > > > > > > createFromInterval(DateTimeInterface $start, DateInterval $interval, > > > DateTimeInterface $end, int $options = 0) > > > → createWithRange(DateTimeInterface $begin, DateTimeInterface $end, > > > DateTimeInterface $int, int $options = 0) > > > > > > createFromRecurrences(DateTimeInterface $start, DateInterval $interval, > > > int $recurrences, int $options = 0) > > > → createWithRecurrences(DateInterval $begin, int $recurrences, > > > DateInterval $interval, int $options = 0) > > > > > > We also should fix the argument names. Either $start/$finish, or > > > $begin/$end. I > > > prefer the latter. > > > > > > createFromIso8601(string $specification, int $options = 0) > > > -> createFromISO8601String > > > > > > I am open to bike shedding about this :-) > > > > > > > On my side, I'd very much prefer keeping the constructor of DatePeriod > and > > thus making it non-overloaded with this signature: > > > > public function __construct(DateTimeInterface $start, DateInterval > > $interval, DateTimeInterface|int $end, int $options = 0) {} > > That still has an overloaded third argument — DateTimeInterface|int. > Where you trying to suggest to change the current existing __construct() > to: > > public function __construct(DateTimeInterface $start, DateInterval > $interval, DateTimeInterface $end, int $options = 0) > > and then add these two new factory methods? > > createFromRecurrences(DateTimeInterface $start, DateInterval $interval, > int $recurrences, int $options = 0) > > createFromISO8601String(string $specification, int $options = 0) >
I really meant DateTimeInterface|int, not an overloaded signature but a union type. My concern is about providing the best path forward. Both deprecating and providing the alternative in the same version creates a lot of friction for end users. After a quick chat with Mate, I think we should do this union type *in addition* to adding the new static constructors. Then, later on, if future us think it's worth it, we might want to consider deprecating passing an integer. This would provide a path for BC/FC I would fully support. Nicolas