vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.57k stars 660 forks source link

UndefinedClass error when calling \GuzzleHttp\Psr7\uri_for #629

Closed ostrolucky closed 6 years ago

ostrolucky commented 6 years ago

ERROR: UndefinedClass - src/Service/Http/StripeHttplugClient.php:36:16 - Class or interface GuzzleHttp\Psr7\UriInterface does not exist $uri = Psr7\uri_for($absUrl)->withQuery(http_build_query($params, '', '&', PHP_QUERY_RFC3986));

Not sure why is psalm trying to locate GuzzleHttp\Psr7\UriInterface. functions.php file where uri_for function is located refers to Psr\Http\Message\UriInterface

Here's the function Psalm complains about https://github.com/guzzle/psr7/blob/99bfec281379c040f37dc3c3e9312476875a2f62/src/functions.php#L54

muglug commented 6 years ago

Looks like a bug inferring namespaced function return types. Will fix.

muglug commented 6 years ago

Psalm wasn't properly analysing vendor-dir function's files (whereas classes would be properly scanned).