rfc:null_coercion_consistency

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
rfc:null_coercion_consistency [2022/04/11 14:50]
craigfrancis More clarify in the Proposal, and test tweaks (thanks Guilliam Xavier)
rfc:null_coercion_consistency [2022/04/11 16:32]
craigfrancis Update note about user-defined functions specifying parameter types (thanks George Peter Banyard)
Line 99: Line 99:
 NULL can usually be coerced, but... NULL can usually be coerced, but...
  
-  - PHP 7.0 introduced the ability for user-defined functions to specify parameter types via the [[https://wiki.php.net/rfc/scalar_type_hints_v5#behaviour_of_weak_type_checks|Scalar Type Declarations RFC]], where the focus was on //strict_types=1//. But the implementation caused Type Error when coercing NULL for everyone (even when not using //strict_types=1//)this seems more of an over-sight, with developers not using //strict_types=1// being unlikely to notice (as they won't specify types in their user defined functions).+  - PHP 7.0 introduced the ability for user-defined functions to specify parameter types via the [[https://wiki.php.net/rfc/scalar_type_hints_v5#behaviour_of_weak_type_checks|Scalar Type Declarations RFC]], where the focus was on //strict_types=1//. But the implementation also caused Type Errors when not using //strict_types=1//, which seems more of an over-sight (breaking null coercionand introducing a type check, for an environment that does not expect this).
   - PHP 8.1 continued this inconsistency with internal functions.   - PHP 8.1 continued this inconsistency with internal functions.
  
rfc/null_coercion_consistency.txt · Last modified: 2022/05/11 12:07 by craigfrancis