On Tue, 13 Jun 2023, Nicolas Grekas wrote: > > 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) That works for me. cheers, Derick -- https://derickrethans.nl | https://xdebug.org | https://dram.io Author of Xdebug. Like it? Consider supporting me: https://xdebug.org/support Host of PHP Internals News: https://phpinternals.news mastodon: @derickr@phpc.social @xdebug@phpc.social twitter: @derickr and @xdebug
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php