-
Notifications
You must be signed in to change notification settings - Fork 28
PHP 8: Add support for CurlHandle resource objects #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,9 +69,9 @@ class PromiseCore | |
/** | ||
* Create shared core. | ||
* | ||
* @param RequestInterface $request HTTP request. | ||
* @param resource $handle cURL handle. | ||
* @param ResponseBuilder $responseBuilder Response builder. | ||
* @param RequestInterface $request HTTP request. | ||
* @param resource|CurlHandle $handle cURL handle. | ||
* @param ResponseBuilder $responseBuilder Response builder. | ||
* | ||
* @throws \InvalidArgumentException If $handle is not a cURL resource. | ||
*/ | ||
|
@@ -80,7 +80,7 @@ public function __construct( | |
$handle, | ||
ResponseBuilder $responseBuilder | ||
) { | ||
if (!is_resource($handle)) { | ||
if (!is_resource($handle) && !(is_object($handle) && $handle instanceof \GdImage)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i am confused by the second part, i assume you meant CurlHandle rather than GdImage? but i think we should make an explicit check for the php version. something like
|
||
throw new \InvalidArgumentException( | ||
sprintf( | ||
'Parameter $handle expected to be a cURL resource, %s given', | ||
|
@@ -89,7 +89,7 @@ public function __construct( | |
); | ||
} | ||
|
||
if (get_resource_type($handle) !== 'curl') { | ||
if (is_resource($handle) && get_resource_type($handle) !== 'curl') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check for php version. maybe we should split all checks into something like this?
|
||
throw new \InvalidArgumentException( | ||
sprintf( | ||
'Parameter $handle expected to be a cURL resource, %s resource given', | ||
|
@@ -138,7 +138,7 @@ public function addOnRejected(callable $callback): void | |
/** | ||
* Return cURL handle. | ||
* | ||
* @return resource | ||
* @return resource|\CurlHandle | ||
*/ | ||
public function getHandle() | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or add CurlHandle to the
use
classes