> > > As you have possibly already experienced, overloaded signatures cause > > various smaller and bigger issues, while the concept is not natively > > supported by PHP. That's why I drafted an RFC which intends to phase > > out the majority of overloaded function/method signatures and also > > forbid the introduction of such functions in the future: > > https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures > > 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'd help a lot with the migration/BC path and this signature also just makes sense. Unrelated: I don't think adding "ReflectionMethod::createFromMethodName" is useful. Using explode is just fine for those that need this style. And since this is the recommended migration path, better not give a reason to change twice the code. I like everything else in the RFC. I'm going to go with the "short path" of deprecating things because the migration paths look smooth enough, thanks for taking the time to explain them all (I just have a concern with the DatePeriod migration path, which would be fixed with my suggestion bove.) Thanks! Nicolas