rfc:php-namespace-in-core
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:php-namespace-in-core [2020/03/25 18:42] – brzuchal | rfc:php-namespace-in-core [2020/04/15 12:30] – Changed status brzuchal | ||
---|---|---|---|
Line 2: | Line 2: | ||
* Version: 0.9 | * Version: 0.9 | ||
* 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 is that core classes which are tightly coupled with the core can start using `PHP` namespace for type prefixes. | + | Introduction of PHP namespace |
- | ===== Proposal ===== | + | This is not a concrete proposal on how to structure the namespace |
- | This RFC proposes | + | |
- | ==== New symbols tightly coupled to the core ==== | + | ===== Features which could benefit from the PHP namespace ===== |
- | We can either have `PhpToken` and `PhpAttribute` classes of which the second one is a future RFC proposal. | + | |
- | But with the PHP namespace, those names can be clean like `PHP\Token` and `PHP\Attribute`. | + | |
- | That kind of symbols belongs only to the core. Therefore they will newer be unbundled and moved to PECL. | + | * The recently accepted [[rfc: |
+ | * The currently under discussion [[rfc: | ||
- | In hypothetically new RFC for small refactor like was done for [[https:// | + | 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 |
- | for eg. `debug_backtrace()` which currently produces an array of arrays | + | |
- | ==== Renaming to fix some mistakes | + | ==== A small toy-example |
- | Currently | + | Currently |
- | From type perspective, | + | ===== A chance to clean up poor design/ |
- | Current `ReflectionType` functions as a type constraint in general therefore renaming it to `ReflectionTypeConstraint` could be a good way to resolve those issues and concerns. | + | Currently within the Reflection extension we have the following classes '' |
- | This RFC is not about renaming those classes but presents some mistakes taken in the past which cannot | + | From PHP's type system perspective, |
- | What this RFC opens is a way to make some cleanups and in this specific example opens a way to alias `ReflectionType` as a `PHP\ReflectionTypeConstraint` (technically in the opposite direction) so then `PHP\ReflectionType` can be used as a top reflector for all kind of types which can be introduced in a future, like enums generics etc. | + | This RFC could allow us to redesign, with the benefit |
- | 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. | + | |
- | ===== Backward Incompatible Changes ===== | + | Continuing from the previous example we could alias '' |
- | No incompatible changes | + | |
- | ===== Proposed PHP Version(s) ===== | + | Another infamous example would be some of the data structures provides by the SPL extension. Indeed as <php> SplQueue extends SplDoublyLinkedList</ |
- | Next PHP 8.x. | + | |
- | ===== RFC Impact | + | Although some of these concerns may be fixed with the introduction of the [[https:// |
- | ==== To SAPIs ==== | + | |
- | None. | + | ===== Proposal |
+ | Allow tightly coupled internal/ | ||
- | ==== To Existing Extensions | + | ===== Backward Incompatible Changes |
- | None. | + | No backwards incompatible changes as we would only introduce new classes under a the '' |
- | + | ||
- | ==== To Opcache | + | |
- | None. | + | |
- | ==== New Constants | + | ===== Proposed PHP Version ===== |
- | None. | + | Next PHP 8.0. |
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
- | As this is a language change, a 2/3 majority is required. | ||
- | The vote is a straight Yes/No vote for accepting | + | The vote is a straight Yes/No vote requiring a 2/3 majority to accept |
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
This RFC doesn' | This RFC doesn' | ||
rfc/php-namespace-in-core.txt · Last modified: 2020/06/04 11:51 by brzuchal