rfc:stricter_implicit_boolean_coercions
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:stricter_implicit_boolean_coercions [2022/05/31 15:27] – Fix Github link iquito | rfc:stricter_implicit_boolean_coercions [2022/06/20 16:00] (current) – Change status to declined and close voting iquito | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2022-05-16 | * Date: 2022-05-16 | ||
* Author: Andreas Leathley, < | * Author: Andreas Leathley, < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 160: | Line 160: | ||
^ From bool | always possible (coerced to "" | ^ From bool | always possible (coerced to "" | ||
- | This RFC would further reduce the gap between strict mode and coercive mode, as even in coercive mode no information would be lost when coercing a scalar value and only values that are reasonable are accepted (otherwise a deprecation notice is emitted). All allowed coercions can be reversed to end up with the original value or almost the same (" | + | This RFC would further reduce the gap between strict mode and coercive mode, as even in coercive mode no information would be lost when coercing a scalar value and only values that are reasonable are accepted (otherwise a deprecation notice is emitted). All allowed coercions can be reversed to end up with the original value or almost the same (" |
<PHP> | <PHP> | ||
Line 191: | Line 191: | ||
</ | </ | ||
- | Having as little information loss between scalar type coercions | + | Having as little information loss as possible |
===== Implementation notes ===== | ===== Implementation notes ===== | ||
Line 232: | Line 232: | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
- | While this RFC only targets boolean coercions when not using strict_types, | + | While this RFC only targets boolean coercions when not using strict_types, |
- | One benefit of these well-developed coercions could be to make them available in an explicit way to PHP developers. Having functions like '' | + | One benefit of these well-developed coercions could be to make them available in an explicit way to PHP developers. Having functions like '' |
- | If this RFC is accepted I would likely follow up with a discussion about a way to invoke the implicit coercion behavior in an explicit way, which would make it available to PHP developers even when using strict_types. A preliminary | + | An example |
| | ||
===== Proposed PHP Version ===== | ===== Proposed PHP Version ===== | ||
Line 248: | Line 248: | ||
* Implicit boolean expressions (as used in if, ternary, logic operators) are not affected. | * Implicit boolean expressions (as used in if, ternary, logic operators) are not affected. | ||
* FILTER_VALIDATE_BOOLEAN in the filter extension is not affected. | * FILTER_VALIDATE_BOOLEAN in the filter extension is not affected. | ||
+ | | ||
+ | ===== Vote ===== | ||
+ | |||
+ | Voting started on 2022-06-06 and will end on 2022-06-20. | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== |
rfc/stricter_implicit_boolean_coercions.1654010865.txt.gz · Last modified: 2022/05/31 15:27 by iquito