yohang / CalendR

The missing PHP 5.3+ calendar management library.
http:/yohan.giarel.li/CalendR
MIT License
465 stars 65 forks source link

Wrong return types in Calendar #48

Open garak opened 6 years ago

garak commented 6 years ago

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").

yohang commented 5 years ago

True.

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