-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Add more specific array return type hints for various extensions - part 6 #7474
Conversation
ext/sockets/sockets.stub.php
Outdated
@@ -70,9 +70,16 @@ function socket_recvfrom(Socket $socket, &$data, int $length, int $flags, &$addr | |||
|
|||
function socket_sendto(Socket $socket, string $data, int $length, int $flags, string $address, ?int $port = null): int|false {} | |||
|
|||
/** | |||
* @return array<string, int>|int|false |
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.
At least string
is also a possible array value, for SO_ACCEPTFILTER. I haven't tracked down what exactly php_do_getsockopt_ipv6_rfc3542 returns.
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.
Looks like php_do_getsockopt_ipv6_rfc3542
returns array<string, null>
due to to_zval_read_in6_pktinfo
?
I can remove this type hint though, if we feel unsafe about it.
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.
Yeah, I think it's safer to just make this array<string, mixed>
.
ext/openssl/openssl.stub.php
Outdated
@@ -71,6 +75,10 @@ function openssl_csr_sign(OpenSSLCertificateSigningRequest|string $csr, OpenSSLC | |||
/** @param OpenSSLAsymmetricKey $private_key */ | |||
function openssl_csr_new(array $distinguished_names, &$private_key, ?array $options = null, ?array $extra_attributes = null): OpenSSLCertificateSigningRequest|false {} | |||
|
|||
/** | |||
* @return array<int, string|array>|false |
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.
This doesn't look right ... shouldn't the keys be string
?
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.
You might want to build with CFLAGS="-DZEND_VERIFY_FUNC_INFO=1"
.
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.
yes, you are right!
…rt 6 ext/oci8, ext/openssl, ext/sockets, ext/libsodium
ddb9ef9
to
4625713
Compare
@nikic Could you have another look at this PR (and possibly at the other similar ones)? I believe I addressed your comments. |
ext/sockets/sockets.stub.php
Outdated
function socket_get_option(Socket $socket, int $level, int $option): array|int|false {} | ||
|
||
/** @alias socket_get_option */ | ||
/** | ||
* @return array<string, int>|int|false |
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.
Does not match alias?
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.
Yes, you're right. Fixed.
* PHP-8.1: Set opline before calling undef op helper Add more specific array return type hints for various extensions - part 6 (#7474)
ext/oci8, ext/openssl, ext/sockets, ext/libsodium