rfc:curl_setopt_strict_types

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:curl_setopt_strict_types [2017/04/22 02:07] – Minor rephrasing colinodellrfc:curl_setopt_strict_types [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 2: Line 2:
   * Version: 0.1   * Version: 0.1
   * Date: 2017-04-21   * Date: 2017-04-21
-  * Author: Sara Golemon <pollita@php.net> 
   * Author: Colin O'Dell <colinodell@gmail.com>   * Author: Colin O'Dell <colinodell@gmail.com>
-  * Status: Draft+  * Author: Sara Golemon <pollita@php.net> 
 +  * Status: Under Discussion
   * First Published at: https://wiki.php.net/rfc/curl_setopt_strict_types   * First Published at: https://wiki.php.net/rfc/curl_setopt_strict_types
  
Line 22: Line 22:
   * ''\Callable''   * ''\Callable''
   * ''\Iterable''   * ''\Iterable''
 +  * ''resource<stream>''
  
 However, each particular option always expects a certain type, so it makes sense to enforce these types in strict type checking mode. However, each particular option always expects a certain type, so it makes sense to enforce these types in strict type checking mode.
Line 39: Line 40:
 ===== Proposal ===== ===== Proposal =====
  
-When ''declare(strict_types=1)'' is used, PHP will now check the third argument of ''curl_setopt'' to ensure it contains the expected type for the given setting.  Checks will be added for the following types:+When ''declare(strict_types=1)'' is used, PHP will now check the third argument of ''curl_setopt()'' to ensure it contains the expected type for the given setting.  Checks will be added for the following types:
  
   * ''bool''   * ''bool''
Line 46: Line 47:
   * ''\Callable''   * ''\Callable''
   * ''\Iterable''   * ''\Iterable''
 +  * ''resource<stream>''
  
 Passing the incorrect type while strict type checks are enabled would result in a ''TypeError'' with a message like this: Passing the incorrect type while strict type checks are enabled would result in a ''TypeError'' with a message like this:
Line 55: Line 57:
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
  
-Any existing code using ''curl_setopt()'' with strict type checking enabled will need to be updated it doesn't provide the proper types.+Any existing code using ''curl_setopt()'' with strict type checking enabled will need to be updated if it doesn't provide the proper types.
  
 Code not using strict type checking (or which already passes the proper types) would be unaffected. Code not using strict type checking (or which already passes the proper types) would be unaffected.
Line 74: Line 76:
  
 ===== References ===== ===== References =====
-Mailing list discussion: TODO+Mailing list discussion: [[http://marc.info/?l=php-internals&m=149286128912117&w=2]]
rfc/curl_setopt_strict_types.1492826821.txt.gz · Last modified: 2017/09/22 13:28 (external edit)