psalm: Invalid MissingDependency error

Running psalm 4.4.0 on PHP 7.2 shows error SimpleXMLElement depends on class or interface stringable that does not exist for any reference to SimpleXMLElement.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@weirdan @orklah Thank you very much for the insights on the phpVersion option and flag. 👍

Regarding this issue: Do we really need to have implements \Stringable in this line? As PHP 8.0 automatically adds the Stringable interface to every class implementing __toString(), wouldn’t it be an alternative to include the method definition of __toString() in the SimpleXMLElement stub? This would make the stub compatible with all PHP versions.

@orklah Ah, right! I misunderstood your message. It turns out there is already a test case for exactly this behavior, so we are fine.

I have fixed this issue in https://github.com/vimeo/psalm/pull/5037.