- changed status to resolved
Incorrect ReflectionParameter type information for some methods in php 8
https://bitbucket.org/osmanov/pecl-event/src/master/php8/php_event.stub.php.in seems to have some incorrect types
public function search(int $what, int $start = -1, int $end = -1): int|false {}
Should int $what
be string $what
instead for https://www.php.net/manual/en/eventbuffer.search.php?
https://www.php.net/manual/en/eventconfig.avoidmethod.php says that the method should be string, not EventConfig.
class EventUtil {
private function __construct() {}
public static function getLastSocketErrno(?\Socket $socket = null): int|false {}
public static function getLastSocketError(?mixed $socket = null): int|false {}
Should getLastSocketError’s return type include string
, not int
The incorrect reflection information may cause issues if php is compiled with --enable-debug
if I remember correctly.
(I’m currently looking into making sure parameter names and types and return types are consistent with other sources of type information for php 8 )
I haven’t checked if these issues affect php 7. The build/gen_stubs.php script also supports /** @generate-legacy-arginfo */
which may or may not be useful in keeping php 7 and 8 parameter names and types in sync (may cause problems for resource->object conversions, not sure if #if macros would help)
If you see some issues with the docs, one way to propose changes to docs and have people review it first would be through a PR to https://github.com/php/doc-en/
Comments (2)
-
repo owner -
repo owner Should
int $what
bestring $what
instead for https://www.php.net/manual/en/eventbuffer.search.php?https://www.php.net/manual/en/eventconfig.avoidmethod.php says that the method should be string, not EventConfig.
Should getLastSocketError’s return type include
string
, notint
Oh, that’s right. Fixed in 3.0.2
I haven’t checked if these issues affect php 7.
No, these issues do not affect PHP 7, since they are all in the stub which is only used for PHP 8.
The build/gen_stubs.php script also supports
/** @generate-legacy-arginfo */
which may or may not be useful in keeping php 7 and 8 parameter names and types in syncI’m going to leave the PHP 7 source intact even if it doesn’t fully match PHP 8. Besides, strict argument types can scarcely be found in pre PHP 8 source.
Thank you!
- Log in to comment
Fixed
#65: some methods had wrong argument/return type hints→ <<cset 008c8e64014c>>