rfc:attribute_amendments

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:attribute_amendments [2020/06/01 22:39] – Add paragraph about trailing commas in attribute group beberleirfc:attribute_amendments [2020/06/04 09:11] beberlei
Line 11: Line 11:
 This RFC discusses a few amendments to the [[https://wiki.php.net/rfc/attributes_v2|original Attributes RFC]] that was accepted for PHP 8. This RFC discusses a few amendments to the [[https://wiki.php.net/rfc/attributes_v2|original Attributes RFC]] that was accepted for PHP 8.
  
-===== Rename PhpAttribute class to Attributes\Attribute =====+===== Rename PhpAttribute class to Attribute =====
  
-<nowiki>Important Context: Since the acceptence of Attributes, the //PhpCompilerAttribute// and //PhpAttribute// classes were unified to be just //PHpAttribute//. This was needed because the previous approach of disallowing the use of <<PhpCompilerAttribute>> in userland would break "stub" generation that static analysis and IDEs rely on to fill their type database of internal functions/classes. Without it there was no functionality left in //PhpCompilerAttribute//.</nowiki>+<nowiki>Important Context: Since the acceptence of Attributes, the PhpCompilerAttribute and PhpAttribute classes were unified to be only PhpAttribute. This was needed because the previous approach of disallowing the use of <<PhpCompilerAttribute>> in userland would break "stub" generation that static analysis and IDEs rely on to fill their type database of internal functions/classes. Without it there was no functionality left in PhpCompilerAttribute to preserve.</nowiki>
  
 The original RFC introduced a //PhpAttribute// class to be added to new The original RFC introduced a //PhpAttribute// class to be added to new
Line 21: Line 21:
  
 In absence of a namespace policy, the global namespace is PHPs namespace. The In absence of a namespace policy, the global namespace is PHPs namespace. The
-documentation states as much. But the set of all attributes is a logical unit of code and namespaces are a concept that helps grouping them+documentation states as much and the vote on https://wiki.php.net/rfc/php-namespace-in-core confirmed this.
  
-We propose to rename //PhpAttribute// to be namespaced under //Attributes\Attribute// and in addition +Therefore we propose to rename //PhpAttribute// to be just //Attribute// and in addition 
-recommend that all internal/compiler attributes should be placed under that namespace.+recommend that all internal/compiler attributes should be placed under the global namespace as well.
  
-Extensions providing non-core functionality should consider using their own namespace, but this RFC makes no recommendation or rule about this.+Extensions providing non-core attributes should consider using their own namespace, but this RFC makes no recommendation or rule about this.
  
 ===== Group statement for Attributes ===== ===== Group statement for Attributes =====
Line 185: Line 185:
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
  
-No breaks.+Introducing a class //Attribute// into the global namespace is certainly going to break at least a handful of applications using this class name
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
Line 212: Line 212:
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
  
-  - Should //PhpAttribute// be renamed to //Attributes\Attribute//?+  - Should //PhpAttribute// be renamed to //Attribute//?
   - Should a secondary grouped syntax for attributes be introduced?   - Should a secondary grouped syntax for attributes be introduced?
   - Should attributes allow definition of target declarations?   - Should attributes allow definition of target declarations?
rfc/attribute_amendments.txt · Last modified: 2020/06/29 09:07 by beberlei