rfc:reserve_even_more_types_in_php_7

PHP RFC: Reserve Even More Types in PHP 7

Proposal

This RFC adds to https://wiki.php.net/rfc/reserve_more_types_in_php_7 to prevents the use of the following additional words to be used as a class, interface or trait name:

  • “resource”
  • “object”
  • “scalar”
  • “mixed”
  • “numeric”

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.

Rationale

Facilitate Future RFCs

Reserving these words in PHP 7 would allow for another RFC to add scalar types in a minor release such as PHP 7.1 (assuming they make no backwards compatibility breaks). Without reserving them now a future RFC would only be able to target major PHP versions such as version 8 since they would break backwards compatibility.

Disallowing Classes

Given that PHP has primitive types such as int, float, string 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

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

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

Potentially future RFCs could:

  • add explicit scalar type support for parameter and return types
  • add union types, such as int|false

Result

The following class names are now reserved:

  • “resource”
  • “object”
  • “mixed”
  • “numeric”

The following class names have not been reserved:

  • “scalar”

Vote

The vote will be a simple “yes” or “no”: do you vote in favor of reserving these type names?

This RFC requires at least two thirds of the votes for a given type name to be “yes” to pass, and also requires the passage of https://wiki.php.net/rfc/reserve_more_types_in_php_7 or one of the ScalarTypeHints RFC (which implicitly reserve the base types by using them).

Reserved Type: resource
Real name Yes No
ajf (ajf)  
bishop (bishop)  
brianlmoon (brianlmoon)  
bwoebi (bwoebi)  
danack (danack)  
datibbaw (datibbaw)  
daverandom (daverandom)  
derick (derick)  
diegopires (diegopires)  
dm (dm)  
dmitry (dmitry)  
dragoonis (dragoonis)  
eliw (eliw)  
fredemmott (fredemmott)  
guilhermeblanco (guilhermeblanco)  
hywan (hywan)  
ircmaxell (ircmaxell)  
irker (irker)  
ivonascimento (ivonascimento)  
jedibc (jedibc)  
jgmdev (jgmdev)  
jmikola (jmikola)  
joey (joey)  
jwage (jwage)  
kalle (kalle)  
kguest (kguest)  
kinncj (kinncj)  
laruence (laruence)  
lcobucci (lcobucci)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
mj (mj)  
nikic (nikic)  
ocramius (ocramius)  
pauloelr (pauloelr)  
pollita (pollita)  
ramsey (ramsey)  
rdlowrey (rdlowrey)  
rdohms (rdohms)  
rmf (rmf)  
salathe (salathe)  
santiagolizardo (santiagolizardo)  
sebastian (sebastian)  
seld (seld)  
stas (stas)  
stelianm (stelianm)  
subjective (subjective)  
svpernova09 (svpernova09)  
thekid (thekid)  
timo (timo)  
toby (toby)  
yohgaki (yohgaki)  
yunosh (yunosh)  
zeev (zeev)  
zimt (zimt)  
Final result: 40 18
This poll has been closed.

.

Reserved Type: scalar
Real name Yes No
ajf (ajf)  
bishop (bishop)  
brianlmoon (brianlmoon)  
bwoebi (bwoebi)  
danack (danack)  
datibbaw (datibbaw)  
daverandom (daverandom)  
derick (derick)  
diegopires (diegopires)  
dm (dm)  
dmitry (dmitry)  
dragoonis (dragoonis)  
eliw (eliw)  
fredemmott (fredemmott)  
guilhermeblanco (guilhermeblanco)  
hywan (hywan)  
ircmaxell (ircmaxell)  
irker (irker)  
ivonascimento (ivonascimento)  
jedibc (jedibc)  
jgmdev (jgmdev)  
jmikola (jmikola)  
joey (joey)  
jwage (jwage)  
kalle (kalle)  
kguest (kguest)  
laruence (laruence)  
lcobucci (lcobucci)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
mj (mj)  
nikic (nikic)  
ocramius (ocramius)  
pauloelr (pauloelr)  
pollita (pollita)  
ramsey (ramsey)  
rdlowrey (rdlowrey)  
rdohms (rdohms)  
salathe (salathe)  
santiagolizardo (santiagolizardo)  
sebastian (sebastian)  
stas (stas)  
stelianm (stelianm)  
subjective (subjective)  
svpernova09 (svpernova09)  
thekid (thekid)  
timo (timo)  
toby (toby)  
yohgaki (yohgaki)  
zimt (zimt)  
Final result: 34 19
This poll has been closed.

.

Reserved Type: object
Real name Yes No
ajf (ajf)  
bishop (bishop)  
brianlmoon (brianlmoon)  
bwoebi (bwoebi)  
danack (danack)  
datibbaw (datibbaw)  
daverandom (daverandom)  
derick (derick)  
diegopires (diegopires)  
dm (dm)  
dmitry (dmitry)  
dragoonis (dragoonis)  
eliw (eliw)  
fredemmott (fredemmott)  
guilhermeblanco (guilhermeblanco)  
hywan (hywan)  
ircmaxell (ircmaxell)  
irker (irker)  
ivonascimento (ivonascimento)  
jedibc (jedibc)  
jgmdev (jgmdev)  
jmikola (jmikola)  
joey (joey)  
jwage (jwage)  
kalle (kalle)  
kguest (kguest)  
laruence (laruence)  
lcobucci (lcobucci)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
mj (mj)  
nikic (nikic)  
ocramius (ocramius)  
pauloelr (pauloelr)  
pollita (pollita)  
ramsey (ramsey)  
rdlowrey (rdlowrey)  
rdohms (rdohms)  
rmf (rmf)  
salathe (salathe)  
santiagolizardo (santiagolizardo)  
sebastian (sebastian)  
stas (stas)  
stelianm (stelianm)  
subjective (subjective)  
svpernova09 (svpernova09)  
thekid (thekid)  
timo (timo)  
toby (toby)  
yohgaki (yohgaki)  
yunosh (yunosh)  
zeev (zeev)  
Final result: 45 10
This poll has been closed.

.

Reserved Type: mixed
Real name Yes No
ajf (ajf)  
bishop (bishop)  
brianlmoon (brianlmoon)  
bwoebi (bwoebi)  
danack (danack)  
datibbaw (datibbaw)  
daverandom (daverandom)  
derick (derick)  
diegopires (diegopires)  
dm (dm)  
dmitry (dmitry)  
dragoonis (dragoonis)  
eliw (eliw)  
fredemmott (fredemmott)  
guilhermeblanco (guilhermeblanco)  
hywan (hywan)  
ircmaxell (ircmaxell)  
irker (irker)  
ivonascimento (ivonascimento)  
jedibc (jedibc)  
jgmdev (jgmdev)  
jmikola (jmikola)  
joey (joey)  
jwage (jwage)  
kalle (kalle)  
kguest (kguest)  
laruence (laruence)  
lcobucci (lcobucci)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
mj (mj)  
nikic (nikic)  
ocramius (ocramius)  
pauloelr (pauloelr)  
pollita (pollita)  
ramsey (ramsey)  
rdlowrey (rdlowrey)  
rdohms (rdohms)  
salathe (salathe)  
santiagolizardo (santiagolizardo)  
sebastian (sebastian)  
seld (seld)  
stas (stas)  
stelianm (stelianm)  
subjective (subjective)  
svpernova09 (svpernova09)  
thekid (thekid)  
timo (timo)  
toby (toby)  
yohgaki (yohgaki)  
yunosh (yunosh)  
zeev (zeev)  
zimt (zimt)  
Final result: 41 15
This poll has been closed.

.

Reserved Type: numeric
Real name Yes No
ajf (ajf)  
andrey (andrey)  
bishop (bishop)  
brianlmoon (brianlmoon)  
bwoebi (bwoebi)  
danack (danack)  
datibbaw (datibbaw)  
daverandom (daverandom)  
derick (derick)  
diegopires (diegopires)  
dm (dm)  
dmitry (dmitry)  
dragoonis (dragoonis)  
eliw (eliw)  
fredemmott (fredemmott)  
guilhermeblanco (guilhermeblanco)  
hywan (hywan)  
ircmaxell (ircmaxell)  
irker (irker)  
ivonascimento (ivonascimento)  
jedibc (jedibc)  
jgmdev (jgmdev)  
jmikola (jmikola)  
joey (joey)  
jwage (jwage)  
kalle (kalle)  
kguest (kguest)  
laruence (laruence)  
lcobucci (lcobucci)  
leigh (leigh)  
levim (levim)  
lstrojny (lstrojny)  
mbeccati (mbeccati)  
mike (mike)  
mj (mj)  
nikic (nikic)  
ocramius (ocramius)  
pauloelr (pauloelr)  
pollita (pollita)  
ramsey (ramsey)  
rdlowrey (rdlowrey)  
rdohms (rdohms)  
salathe (salathe)  
santiagolizardo (santiagolizardo)  
sebastian (sebastian)  
seld (seld)  
stas (stas)  
stelianm (stelianm)  
subjective (subjective)  
svpernova09 (svpernova09)  
thekid (thekid)  
timo (timo)  
toby (toby)  
yohgaki (yohgaki)  
zeev (zeev)  
zimt (zimt)  
Final result: 44 12
This poll has been closed.

Voting opened on 2015-03-15 and will end on the later of 2015-03-29 or the close of all currently open Scalar Type Hint votes and Levi's scalar types reservation RFCs.

Patches and Tests

There is currently no implementation.

rfc/reserve_even_more_types_in_php_7.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1