Skip to content

Change int types to bool when possible #6148

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

Closed
wants to merge 1 commit into from

Conversation

kocsismate
Copy link
Member

This changes ob_implicit_flush() and sem_get() to accept a bool instead of an int when the parameter behaves as a bool.

If it's really possible to make this change, I'll add an UPGRADING entry.

Copy link
Member

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this. Might affect some strict_types code, but I think both of these are sufficiently obscure that working around it is not an undue hassle.

@cmb69
Copy link
Member

cmb69 commented Sep 16, 2020

I just stumbled upon ob_implicit_flush() the other day, and at first thought the docs needed to be fixed. So yes, +1 from me.

@php-pulls php-pulls closed this in 46d22e4 Sep 17, 2020
@kocsismate kocsismate deleted the int-to-bool branch September 17, 2020 07:40
jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request Oct 2, 2020
…amType` sniff

>  The `$auto_release` parameter of `sem_get()` was changed to accept bool values
>  rather than int.

> The $flag parameter of ob_implicit_flush() was changed to accept bool
> values rather than int.

This new sniff will detect hard-coded integer/float values being passed as the affected parameter in the above mentioned functions.

The sniff has been set up to allow for more functions / function parameters to be added in the future.

Includes unit tests.

Refs:
* https://github.com/php/php-src/blob/0a84fba0deb1c1b75770a436c4236dc56e6d0463/UPGRADING#L621-L622
* https://github.com/php/php-src/blob/0a84fba0deb1c1b75770a436c4236dc56e6d0463/UPGRADING#L813-L814
* php/php-src#6148
* php/php-src@46d22e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants