Bug #80229 [Opn->Csd]: assert_options should have "int" and "bool" for $value parameter PHPDoc

From: Date: Sat, 17 Oct 2020 10:01:26 +0000
Subject: Bug #80229 [Opn->Csd]: 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-229687@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 Updated by: kocsismate@php.net Reported by: ondrej at mirtes dot cz Summary: assert_options should have "int" and "bool" for $value parameter PHPDoc -Status: Open +Status: Closed Type: Bug Package: Reflection related PHP Version: 8.0.0rc1 Block user comment: N Private report: N New Comment: Automatic comment on behalf of kocsismate@woohoolabs.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=f076ab0c0cd352cdd70040ba50d40cd229a463ad Log: Fix #80229: assert_options should have int and bool for parameter PHPDoc Previous Comments: ------------------------------------------------------------------------ [2020-10-17 09:41:32] kocsismate@php.net > TBH I think we should just mark this as a "mixed" argument. I came to the same conclusion a few days ago when I was thinking about this problem. Although, I was slightly concerned that the mixed type is used when it's not 100% correct. But that's sure, it's the closest approximation of string|callable|int|bool|null that we can add easily. ------------------------------------------------------------------------ [2020-10-17 09:33:48] kocsismate@php.net The following pull request has been associated: Patch Name: Fix #80229: assert_options should have int and bool for parameter PHPDoc On GitHub: https://github.com/php/php-src/pull/6348 Patch: https://github.com/php/php-src/pull/6348.patch ------------------------------------------------------------------------ [2020-10-15 10:27:12] nikic@php.net The problem here is that assert_option internally treats the value as a string, which is why it was documented as such. Of course, the user would rather pass int/bool. This is a similar situation to ini_set, which also accepts a string, while something else might be more convenient. TBH I think we should just mark this as a "mixed" argument. That matches the semantics more closely than some weird string|callable|int|bool|null union. ------------------------------------------------------------------------ [2020-10-14 11:13:54] ondrej at mirtes dot cz 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. ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=80229 -- Edit this bug report at https://bugs.php.net/bug.php?id=80229&edit=1

« previous php.bugs (#229687) next »