chronos
chronos copied to clipboard
Move property docblocks from Chronos and Date to ChronosInterface
I am using PHPStan on my code. I am calling ->year
and ->month
on an object that is typehinted with ChronosInterface
which is causing PHPStan to complain with the error "Access to an undefined property Cake\Chronos\ChronosInterface::$month." Should the docblocks for these shared properties be moved down to ChronosInterface?
Should the docblocks for these shared properties be moved down to ChronosInterface?
The properties aren't part of the interface, so I'm not sure they should be moved down.
Hmmm. I see your point. They come from the PHP base DateTimeImmutable don't they? Is there any way we could tidy this up? Or not?
Those properties come from the __get
implementation in the MagicPropertyTrait
.
Do we expect users to typehint with ChronosInterface for both Date and Chronos objects?
I think users should be able to do what they like.
I think this should be closed. The interface (for obvious reasons) doesn't have these properties so if an implementing class is accessing them the annotation needs to be on that class.