rfc:php-namespace-in-core
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:php-namespace-in-core [2020/04/03 14:04] – Major rewrite girgias | rfc:php-namespace-in-core [2020/06/04 11:51] (current) – closed voting brzuchal | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: PHP Namespace in core ====== | ====== PHP RFC: PHP Namespace in core ====== | ||
- | * Version: | + | * Version: |
* Date: 2020-03-25 | * Date: 2020-03-25 | ||
* Author: Michał Brzuchalski < | * Author: Michał Brzuchalski < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | The PHP project has reserved the right to use the '' | + | The PHP project has reserved the right to use the '' |
- | This would provide a way to reduce the usage of the global namespace as " | + | This paves the way to reduce the usage of the global namespace as " |
- | 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 re-aliasing |
- | + | ||
- | This is not a concrete proposal on how to structure the namespace or a proposal on realising | + | |
===== 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: | * The currently under discussion [[rfc: | ||
- | 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 '' | + | 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 '' |
- | ==== A small toy-example ==== | + | ==== A small concrete |
- | Currently < | + | Currently < |
- | ===== A chance to clean up poor design/ | ||
- | Currently within the Reflection extension we have the following classes '' | ||
- | |||
- | From PHP's type system perspective, | ||
- | |||
- | This RFC could allow us to redesign, with the benefit of hindsight, some of the core APIs provided by PHP. | ||
- | |||
- | Continuing from the previous example we could alias '' | ||
- | |||
- | Another infamous example would be some of the data structures provides by the SPL extension. Indeed as <php> SplQueue extends SplDoublyLinkedList</ | ||
- | |||
- | Although some of these concerns may be fixed with the introduction of the [[https:// | ||
- | |||
===== Proposal ===== | ===== Proposal ===== | ||
- | Allow tightly coupled | + | New features or symbols which are tightly coupled |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | No backwards incompatible changes as we would only introduce | + | No backwards incompatible changes as only new classes/symbols would be introduces |
===== Proposed PHP Version ===== | ===== Proposed PHP Version ===== | ||
- | Next PHP 8.0. | + | PHP 8.0. |
- | ===== RFC Impact | + | ===== Concerns about inconsistent use ===== |
- | ==== To SAPIs ==== | + | Various symbols which are widely used are located in the global namespace, classes such as '' |
- | None. | + | |
- | ==== To Existing Extensions ==== | + | Although some of these fall into the category of being tightly tied to the engine and would land in the '' |
- | None. | + | |
- | ==== To Opcache | + | ===== Future scope ===== |
- | None. | + | Providing new core APIs building on new features introduces in PHP, such as: |
- | ==== New Constants ==== | + | * I/O API using exceptions instead of warnings in case of failure |
- | None. | + | * New data structures to replace SPL data structures, see Appendix for reasons why |
+ | Or revamping current ones: | ||
+ | | ||
+ | * Reflection, see Appendix for a use case | ||
+ | |||
===== 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. | ||
+ | |||
+ | ===== Vote ===== | ||
+ | Voting started on 2020-05-22 and will end on 2020-06-04 at 6:00 UTC. | ||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
This RFC doesn' | This RFC doesn' | ||
+ | ===== Changelog ===== | ||
+ | 1.0.0: Initial version \\ | ||
+ | 1.1.0: New features must use the PHP engine, before this was merely a suggestion \\ | ||
+ | 1.2.0: Major rewrite, addressing concerns about inconsistent usage \\ | ||
+ | |||
+ | ===== Appendix ===== | ||
+ | ==== SPL Data Structures ==== | ||
+ | An infamous example is that <php> SplQueue extends SplDoublyLinkedList</ | ||
+ | |||
+ | Therefore, if a user decides to use these methods instead of the designated < | ||
+ | |||
+ | ==== Reflection ==== | ||
+ | Currently within the Reflection extension we have the following classes '' | ||
+ | |||
+ | From PHP's type system perspective, | ||
+ | |||
+ | Thus, in a revamped Reflection extension one could imagine a more accurate '' |
rfc/php-namespace-in-core.txt · Last modified: 2020/06/04 11:51 by brzuchal