-
-
Notifications
You must be signed in to change notification settings - Fork 934
Closed
Labels
Description
Bug report
PHPStan sees code from PECL library even if it's not used in reality. Example:
<?php
class HttpResponse
{
/**
* Set entity tag (unique tag for this version) for this response
* @param int|string $etag the E-Tag value for this response
* @return void
*/
public function setEtag($etag)
{
printf("\"$etag\"\n");
}
}
define("VERSION", 42);
$http = new HttpResponse();
$http->setETag(VERSION);causes
Parameter #1 $etag of method HttpResponse::setEtag() expects string, int given. even though the setEtag() above clearly allows both int and string in the PhpDoc.
Code snippet that reproduces the problem
https://phpstan.org/r/00ba67d7-da6f-4382-9e7c-6c36e1ac4d61
Expected output
The above code should emit no errors or warnings.
Did PHPStan help you today? Did it make you happy in any way?
PHPStan is a great tool to find potential issues in my code!