rfc:reserve_more_types_in_php_7

Differences

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

Link to this comparison view

Next revision
Previous revision
rfc:reserve_more_types_in_php_7 [2015/02/19 00:05] – created levimrfc:reserve_more_types_in_php_7 [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== PHP RFC: Reserve More Types in PHP 7 ====== ====== PHP RFC: Reserve More Types in PHP 7 ======
-  * Version: 1.0+  * Version: 1.1
   * Date: 2015-02-18   * Date: 2015-02-18
   * Author: Levi Morrison <levim@php.net>   * Author: Levi Morrison <levim@php.net>
-  * Status: Draft +  * Status: Implemented (in PHP 7.0) 
-  * First Published at: http://wiki.php.net/rfc/reserving_scalar_type_names+  * First Published at: http://wiki.php.net/rfc/reserve_more_types_in_php_7
  
 ===== Proposal ===== ===== Proposal =====
-This RFC reserves the following words beginning with PHP 7.0:+This RFC prevents the use of the following words to be used as a class, interface or trait name:
  
-  * ''int'', ''integer'' +  * ''int'' 
-  * ''bool'', ''boolean'' +  * ''float'' 
-  * ''true'', ''false'' +  * ''bool''
-  * ''float'', ''double''+
   * ''string''   * ''string''
 +  * ''true'', ''false''
   * ''null''   * ''null''
  
-This RFC does not fully reserve them as keywords; it only prohibits their usage as class, interface and trait names. +This RFC does not fully reserve them as keywords; it only prohibits their usage as class, interface and trait names. It also prevents them from being used in namespaces.
- +
-This RFC does not reserve ''resource''+
  
 +I have chosen to not reserve ''integer'', ''double'' and ''boolean'' out of interest of proposing the smallest useful subset. Another RFC could reserve these aliases in the future.
  
 ===== Rationale ===== ===== Rationale =====
Line 27: Line 26:
  
 ==== Disallowing Classes ==== ==== Disallowing Classes ====
-Given that PHP has primitive types such as int, float and string it does not make sense for them to exist as classes, or if they do they should be provided by PHP itself.+Given that PHP has primitive types such as int, floatstring and null it does not make sense for them to exist as classes, or if they do they should be provided by PHP itself.
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
-This breaks any and all cases where these new reserved words are used in class, interface or trait names. It does not break any usages as function or method names or as class class constants.+This breaks any and all cases where these new reserved words are used in class, interface or trait names. It does not break any usages as function or method names or as class constants.
  
 ===== Unaffected PHP Functionality ===== ===== Unaffected PHP Functionality =====
-This RFC does not change the way our current parameter and return type hints work. Support for these new reserved words as explicit types is not part of this RFC.+This RFC does not change the way our current parameter and return type hints work. Support for these new reserved words as types for parameters or return types is beyond the scope of this RFC.
  
 ===== Future Scope ===== ===== Future Scope =====
 Potentially future RFCs could: Potentially future RFCs could:
  
 +  * reserve the aliases of these types, such as ''integer'', ''double'' and ''boolean''
   * add explicit scalar type support for parameter and return types   * add explicit scalar type support for parameter and return types
-  * reserve other types such as ''numeric'', ''mixed'' or ''scalar'+  * add union types, such as ''int|false'' 
 +  * reserve other types such as ''numeric'', ''mixed'' or ''scalar''
  
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
Line 45: Line 46:
  
 This RFC requires at least two thirds of the votes to be "yes" to pass. This RFC requires at least two thirds of the votes to be "yes" to pass.
 +
 +<doodle title="reserve_more_types_in_php_7" auth="levim" voteType="single" closed="true">
 +   * Yes
 +   * No
 +</doodle>
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
 There is currently no implementation. There is currently no implementation.
  
 +
 +===== Version History =====
 +
 +  * 1.0: Reserve ''int'', ''integer'', ''float'', ''double'', ''bool'', ''boolean'', ''string'', ''true'', ''false'', ''null''
 +  * 1.1: No longer reserve ''integer'', ''double'' and ''boolean''
rfc/reserve_more_types_in_php_7.1424304332.txt.gz · Last modified: 2017/09/22 13:28 (external edit)