psalm: Method return type not being inferred for templated class

I don’t know how best to describe this issue, but I think the repro will make it fairly clear:

https://psalm.dev/r/c8661b5bb2

Psalm is not inferring that $optional->get() returns string, even though it has correctly inferred that $optional is Optional<string>.

Actual message

INFO: MissingReturnType - 29:10 - Method expandOptions does not have a return type, expecting Collection<mixed>

Expected message

INFO: MissingReturnType - 29:10 - Method expandOptions does not have a return type, expecting Collection<string>

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (5 by maintainers)

Commits related to this issue

Most upvoted comments