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

Fixing union type syntax #163

Closed ThomasLandauer closed 1 year ago

ThomasLandauer commented 3 years ago

Psalm was giving me:

ERROR: UndefinedMethod - ... - Method ZBateson\MailMimeParser\Header\AbstractHeader::getDateTimeImmutable does not exist (see https://psalm.dev/022)

on

$message->getHeader('date')->getDateTimeImmutable()

It looks like line breaks aren't allowed here, even though it's not explicitly documented at https://psalm.dev/docs/annotating_code/type_syntax/union_types/

Anyway - in PHP8 this line will become the very return type - so sooner or later it would have to be shortened by using use anyway ;-)