rfc:php-namespace-in-core

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
Next revisionBoth sides next revision
rfc:php-namespace-in-core [2020/04/06 21:16] – Removed Impact section as this is a process RFC, small tweaks girgiasrfc:php-namespace-in-core [2020/04/15 20:37] – Use must instead of may, Changelog section, small nits girgias
Line 1: Line 1:
 ====== PHP RFC: PHP Namespace in core ====== ====== PHP RFC: PHP Namespace in core ======
-  * Version: 0.9+  * Version: 1.1.0
   * Date: 2020-03-25   * Date: 2020-03-25
   * Author: Michał Brzuchalski <brzuchal@php.net>, George Peter Banyard <girgias@php.net>   * Author: Michał Brzuchalski <brzuchal@php.net>, George Peter Banyard <girgias@php.net>
-  * Status: Draft+  * Status: Under Discussion
   * First Published at: http://wiki.php.net/rfc/php-namespace-in-core   * First Published at: http://wiki.php.net/rfc/php-namespace-in-core
  
 ===== Introduction ===== ===== Introduction =====
-The PHP project has reserved the right to use the ''\PHP'' namespace but has never acted upon starting to use it. We therefore suggest that core symbols which cannot be unbundled such as those related to the language/parser/interpreter may start using the ''\PHP'' namespace.+The PHP project has reserved the right to use the ''\PHP'' namespace but has never acted upon starting to use it. We therefore propose that core symbols which cannot be unbundled such as those related to the language/parser/interpreter must use ''\PHP'' namespace.
  
 This would provide a way to reduce the usage of the global namespace as "PHP"'s namespace and also provide a way to fix some fundamental misnaming. This would provide a way to reduce the usage of the global namespace as "PHP"'s namespace and also provide a way to fix some fundamental misnaming.
  
-Introduction of PHP namespace also as a way for gradual migration over renamed and marked as deprecated symbols reducing breaking changes. [Girgias Note: I'm not sure this sentence makes sense] +This is not a concrete proposal on how to structure the namespace or a proposal on realiasing classes to use the ''\PHP'' namespace. This is only an agreement that core classes or newly introduced symbols which are tightly coupled to the PHP engine must start using the ''\PHP'' namespace, e.g. for type prefixes.
- +
-This is not a concrete proposal on how to structure the namespace or a proposal on realising classes to use the ''\PHP'' namespace. This is only an agreement that core classes or newly introduced symbols which are tightly coupled to the PHP engine may start using the ''\PHP'' namespace, e.g. for type prefixes.+
  
 ===== Features which could benefit from the PHP namespace ===== ===== Features which could benefit from the PHP namespace =====
Line 20: Line 18:
   * The currently under discussion [[rfc:attributes_v2|PHP RFC: Attributes v2]] could use the ''\PHP'' namespace for engine/internal related attributes.   * The currently under discussion [[rfc:attributes_v2|PHP RFC: Attributes v2]] could use the ''\PHP'' namespace for engine/internal related attributes.
  
-As these sort of symbols are tied to the engine there is no risk that they will get unbundled from PHP core and moved to PECL. We note this as we aware that if a non core extension would use the ''\PHP'' namespace and gets unbundled and moved to PECL we would find ourselves in a situation where symbols under the ''\PHP'' namespace are not always available in PHP.+As these sort of symbols are tied to the engine there is no risk that they will get unbundled from PHP core and moved to PECL. We note this as we are aware that if a non core extension would use the ''\PHP'' namespace and gets unbundled and moved to PECL we would find ourselves in a situation where symbols under the ''\PHP'' namespace are not always available in PHP.
  
 ==== A small toy-example ==== ==== A small toy-example ====
Line 26: Line 24:
  
 ===== A chance to clean up poor design/naming decisions ===== ===== A chance to clean up poor design/naming decisions =====
-Currently within the Reflection extension we have the following classes ''ReflectionType'' and ''ReflectionNamedType'' however their purpose isn'exacty to present a type.+Currently within the Reflection extension we have the following classes ''ReflectionType'' and ''ReflectionNamedType'' however their purpose isn'exactly to present a type.
  
 From PHP's type system perspective, a class is a type. Therefore, ''ReflectionClass'' not extending from ''ReflectionType'' could be seen as questionable. Thus the ''ReflectionType'' class acts more as a type constraint and renaming it to ''ReflectionTypeConstraint'' may be a good way to clarify it's concern. From PHP's type system perspective, a class is a type. Therefore, ''ReflectionClass'' not extending from ''ReflectionType'' could be seen as questionable. Thus the ''ReflectionType'' class acts more as a type constraint and renaming it to ''ReflectionTypeConstraint'' may be a good way to clarify it's concern.
Line 39: Line 37:
    
 ===== Proposal ===== ===== Proposal =====
-Allow tightly coupled internal/engine symbols with the PHP interpreter to use the ''\PHP'' namespace.+New features or symbols which are tightly coupled to the internals/engine of the PHP interpreter must use the ''\PHP'' namespace starting from PHP 8.
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
-No backwards incompatible changes as we would only introduce new classes under the ''\PHP'' namespace.+No backwards incompatible changes as only new classes/symbols would be introduces under the ''\PHP'' namespace.
  
 ===== Proposed PHP Version ===== ===== Proposed PHP Version =====
-Next PHP 8.0.+PHP 8.0.
  
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
- 
 The vote is a straight Yes/No vote requiring a 2/3 majority to accept the RFC. The vote is a straight Yes/No vote requiring a 2/3 majority to accept the RFC.
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
 This RFC doesn't provide any changes. This RFC doesn't provide any changes.
 +
 +===== Changelog =====
 +1.0.0: Initial version \\
 +1.1.0: New features must use the PHP engine, before this was merely a suggestion \\
 +
  
rfc/php-namespace-in-core.txt · Last modified: 2020/06/04 11:51 by brzuchal