yohang/CalendR

Wrong return types in Calendar

garak opened this issue · 1 comments

garak commented

Calendar class uses PeriodInterface as return type for getYear, getMonth, getWeek.
Such method should return, respectively, Year, Month, Week, that are implementing \Iterator.
With the current code, a call to foreach (new Calendar)->getMonth() is marked as invalid by phpstorm ("Can not iterate PeriodInterface").

True.

I'll have a look a this for CalendR 3, with drop of PHP 5 support and introduction of return types.