rfc:php-namespace-in-core
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:php-namespace-in-core [2020/03/25 18:29] – created brzuchal | rfc:php-namespace-in-core [2020/04/23 11:17] – Major rewrite girgias | ||
---|---|---|---|
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 ===== | ||
- | Introduce | + | The PHP project has reserved the right to use the '' |
- | Introduction | + | This would provide a way to reduce the usage of the global namespace as "PHP"' |
- | There is no concrete proposal on how to structure the namespaces and the only agreement | + | This is not a concrete proposal on how to structure the namespace or a proposal on realiasing classes to use the '' |
- | ===== Proposal | + | ===== Features which could benefit from the PHP namespace |
- | This RFC proposes to introduce PHP namespace for internal symbols by utilizing the reserved PHP namespace as the root for the symbols that are tightly coupled with PHP interpreter. | + | |
- | ==== New symbols tightly coupled to the core ==== | + | * The recently accepted [[rfc: |
- | We can either have `PhpToken` and `PhpAttribute` classes of which the second one is a future RFC proposal. | + | * The currently under discussion [[rfc: |
- | But with the PHP namespace, those names can be clean like `PHP\Token` and `PHP\Attribute`. | + | |
- | That kind of symbols | + | As these sort of symbols |
- | In hypothetically new RFC for small refactor like was done for [[https:// | + | ==== A small concrete example ==== |
- | for eg. `debug_backtrace()` which currently | + | Currently <php>debug_backtrace()</ |
- | ==== Renaming to fix some mistakes | + | ===== Proposal ===== |
- | Currently we do have `ReflectionType` and `ReflectionNamedType` but their purpose isn't exactly | + | New features or symbols which are tightly coupled |
- | From type perspective, | + | ===== Backward Incompatible Changes ===== |
- | Current `ReflectionType` functions | + | No backwards incompatible changes |
- | This RFC is not about renaming those classes but presents some mistakes taken in the past which cannot be changed between the PHP releases without a huge BC break. | + | ===== Proposed |
+ | PHP 8.0. | ||
- | What this RFC opens is a way to make some cleanups and in this specific example opens a way to alias `ReflectionType` | + | ===== Open Issues ===== |
- | Those kind of changes are not BC breaking changes allows to mark old classes as deprecated for a long period and use new class names in the meantime. | + | W.I.P. SPL Interfaces such as Countable, ArrayAccess, etc. |
- | ===== Backward Incompatible Changes | + | ===== Future scope ===== |
- | No incompatible changes | + | Providing new core APIs building on new features introduces in PHP, such as: |
- | ===== Proposed PHP Version(s) ===== | + | * I/O API using exceptions instead of warnings in case of failure |
- | Next PHP 8.x. | + | * New data structures to replace SPL data structures, see Appendix for reasons why |
- | ===== RFC Impact | + | Or revamping current ones: |
- | ==== To SAPIs ==== | + | |
- | None. | + | * Reflection, see Appendix for a use case |
+ | |||
+ | ===== Proposed Voting Choices | ||
+ | The vote is a straight Yes/No vote requiring a 2/3 majority to accept the RFC. | ||
- | ==== To Existing Extensions | + | ===== Patches and Tests ===== |
- | None. | + | This RFC doesn' |
- | ==== To Opcache | + | ===== Changelog ===== |
- | None. | + | 1.0.0: Initial version \\ |
+ | 1.1.0: New features must use the PHP engine, before this was merely a suggestion \\ | ||
- | ==== New Constants | + | ===== Appendix ===== |
- | None. | + | ==== SPL Data Structures |
+ | An infamous example is that <php> SplQueue extends SplDoublyLinkedList</ | ||
- | ===== Proposed Voting Choices ===== | + | Therefore, if a user decides to use these methods instead of the designated < |
- | As this is a language change, a 2/3 majority | + | |
- | The vote is a straight Yes/No vote for accepting | + | ==== Reflection ==== |
+ | Currently within | ||
- | ===== Patches | + | From PHP's type system perspective, |
- | This RFC doesn't provide any changes. | + | |
+ | 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