Bug #80229 [Com]: assert_options should have "int" and "bool" for $value parameter PHPDoc
| From: | ondrej at mirtes dot cz | Date: | Wed, 14 Oct 2020 11:13:54 +0000 |
| Subject: | Bug #80229 [Com]: assert_options should have "int" and "bool" for $value parameter PHPDoc | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-229611@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80229&edit=1
ID: 80229
Comment by: ondrej at mirtes dot cz
Reported by: ondrej at mirtes dot cz
Summary: assert_options should have "int" and "bool" for
$value parameter PHPDoc
Status: Open
Type: Bug
Package: Reflection related
PHP Version: 8.0.0rc1
Block user comment: N
Private report: N
New Comment:
I don't think this is related to strict_types: https://3v4l.org/Q2EuC
The PHP documentation even talks about 1 (integer) to be a default value, but "int" is
missing in the PHPDoc.
Previous Comments:
------------------------------------------------------------------------
[2020-10-13 16:21:16] cmb@php.net
There are likely some other functions with the same issue. The
problem here is strict_types on vs. off. In case of the latter
the current signature is correct; in case of the former, int and
bool are indeed missing.
Not sure how to resolve this.
------------------------------------------------------------------------
[2020-10-13 14:54:19] ondrej at mirtes dot cz
Description:
------------
The function assert_options accepts integers and booleans as the second argument. Currently
according to the stub's PHPDoc, it only accepts strings, callables and null. The PHPDoc should
be corrected.
I guess the assert_options function can be called with either "1" or "true" for
the same result...
Expected result:
----------------
/** @param string|callable|int|bool|null $value */
function assert_options(int $option, $value = UNKNOWN) : array|object|int|string|null
{
}
Actual result:
--------------
/** @param string|callable|null $value */
function assert_options(int $option, $value = UNKNOWN) : array|object|int|string|null
{
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80229&edit=1