Elao / PhpEnums

:nut_and_bolt: Extended PHP 8.1+ enums features & specific integrations with frameworks and libraries
MIT License
326 stars 27 forks source link

Incorrect use of templated parameters for static functions in templated interfaces #149

Open LuckyRu opened 3 years ago

LuckyRu commented 3 years ago

Example: https://psalm.dev/r/a2b077f2e5 Comment of @weirdan: https://github.com/vimeo/psalm/issues/2571#issuecomment-572011683

ogizanagi commented 3 years ago

Hmm, so we need to add the @template T of int|string line to each static methods, but using the same template name (T) would generate a "Duplicate template param T in docblock for EnumInterface::get" so we need to use another name… this is a bit annoying :/

LuckyRu commented 3 years ago

I think we don't need templates in static methods

bendavies commented 3 years ago

i guess this is the cause of this psalm error: Argument 1 of USState::accepts expects Elao\Enum\T, string provided