Skip to content

Commit

Permalink
Fixed casting CurlHandle to (int)
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Oct 15, 2020
1 parent 8a731f7 commit 842b468
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Type/ObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ public function toInteger(): Type
return new IntegerType();
}

if ($this->getClassName() === 'CurlHandle') {
return new IntegerType();
}

return new ErrorType();
}

Expand Down
5 changes: 5 additions & 0 deletions tests/PHPStan/Rules/Cast/data/invalid-cast.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ function (
(string) $xml;
(bool) $xml;
};

function (): void {
$ch = curl_init();
(int) $ch;
};

0 comments on commit 842b468

Please sign in to comment.