Skip to content

Commit 842b468

Browse files
committed
Fixed casting CurlHandle to (int)
1 parent 8a731f7 commit 842b468

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Type/ObjectType.php

+4
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,10 @@ public function toInteger(): Type
310310
return new IntegerType();
311311
}
312312

313+
if ($this->getClassName() === 'CurlHandle') {
314+
return new IntegerType();
315+
}
316+
313317
return new ErrorType();
314318
}
315319

tests/PHPStan/Rules/Cast/data/invalid-cast.php

+5
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,8 @@ function (
5757
(string) $xml;
5858
(bool) $xml;
5959
};
60+
61+
function (): void {
62+
$ch = curl_init();
63+
(int) $ch;
64+
};

0 commit comments

Comments
 (0)