zbateson / mail-mime-parser

An email parser written in PHP
https://mail-mime-parser.org/
BSD 2-Clause "Simplified" License
458 stars 58 forks source link

Added getAddresses to IHeader.php #222

Closed postme closed 1 year ago

postme commented 1 year ago

phpstan is complaining about method getAddresses:

Cannot call method getAddresses() on ZBateson\MailMimeParser\Header\IHeader

Checked IHeader.php and the interface for getAddresses is missing so phpstan complained correctly. Added the getAddresses method to the interface file and phpstan is happy now :-)

postme commented 1 year ago

Merge failed due too conflict elsewhere in the library:

PHP Fatal error: Class ZBateson\MailMimeParser\Header\GenericHeader contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (ZBateson\MailMimeParser\Header\IHeader::getAddresses)

zbateson commented 1 year ago

Hi Meint,

I'm on vacation this week without much access, but I believe the issue is most likely that getHeader returns IHeader, which is true, but specifically IAddressHeader (a subclass of IHeader) for address types which defines getAddresses. It's possible phpstan wants you to cast to IAddressHeader, or we could specify the return type to include all possible interfaces rather than the generic IHeader.

I'll be back next week and can take a closer look then if it's still puzzling :)

Zaahid

On August 30, 2023 3:03:16 p.m. MDT, "M.E. Post" @.***> wrote:

Merge failed due too conflict elsewhere in the library:

PHP Fatal error: Class ZBateson\MailMimeParser\Header\GenericHeader contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (ZBateson\MailMimeParser\Header\IHeader::getAddresses)

-- Reply to this email directly or view it on GitHub: https://github.com/zbateson/mail-mime-parser/pull/222#issuecomment-1699839476 You are receiving this because you are subscribed to this thread.

Message ID: @.***>