Open ghnp5 opened 3 months ago
Hi @ghnp5 -- you're not wrong, getEmail is part of AddressHeader which is what's returned if you call getHeader('From') -- a class that implements IHeader.
I don't know what makes the most sense here, maybe in documentation I can specify all the concrete classes returned so IDEs are happy. Another option could be to put a docblock before the $from line, or actually specify all classes that could be returned in the function's signature. Open to suggestions if anyone has any.
/* @var AddressHeader $from /
I apply the docblock approach, it keeps phpstorm happy
getHeader
returnsIHeader
, butIHeader
does not containgetEmail
.The code works, but my IDE complains :)
Thanks!