PHP RFC: Additional soft reservations for PHP 7
- Date: 2015-07-03
- Author: Nikita Popov nikic@php.net
- Status: Under Discussion
- Previous discussion: http://markmail.org/message/ovvnz5p2o6q7ebjl
Introduction
A number of type names were already soft-reserved for PHP 7, which means that we reserve the right to introduce these in a minor release and as such strongly discourage their use, however no actual error or warning will be thrown if they are used against this recommendation. This RFC proposes a number of additional soft reservations, which have been previously missed.
Each of the proposed reservations is listed separately in the following. Votes will also happen separately. This RFC is open to additional suggestions.
Reservations
All reservations are case-insensitive.
void
Where: As the last segment of a class, interface or trait name. As such the names Void
and Foo\Bar\Void
are reserved, while Foo\Bar\MyVoid
and Void\Foo\Bar
are okay.
Why: void
is a likely candidate for the demarcation of void functions (which do not return a value). Alternatively null
can be used for this purpose, which is already reserved. However both possibilities should be kept open until we reach a decision on this question.
enum
Where: In any context which is not protected by the context sensitivity RFC. This includes any segment of class, interface, trait and function names.
Why: There already is an enum RFC which will be proposed for PHP 7.x and requires this reserved keyword.
Backward Incompatible Changes
Code using the aforementioned names (in the relevant contexts) should be changed to use a different name. However this is not strictly required.
Proposed Voting Choices
Votes will be per name and require 2/3 majority.