Skip to content

rewinddir() return null|false instead of void #3232

@steevanb

Description

@steevanb

https://www.php.net/manual/en/function.rewinddir.php

PHP documentation for rewinddir() has a bug: return type is not void, but is null or false (see https://www.php.net/manual/en/function.rewinddir.php#refsect1-function.rewinddir-returnvalues).

Example:

$handle = opendir(__DIR__);
var_dump(rewinddir($handle)); // NULL
closedir($handle);
var_dump(rewinddir($handle)); // false with an E_WARNING triggered

It seems that phpstan follow the documentation, because the example above will trigger this error with phpstan:

Result of function rewinddir (void) is used.

Tested on PHP 7.1.0, 7.2.0, 7.3.0 and 7.4.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions