rfc:attributes-on-constants

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
rfc:attributes-on-constants [2024/11/30 16:50] – created danielescherzerrfc:attributes-on-constants [2024/12/16 05:45] (current) – start the vote, runs until 2025-01-06 danielescherzer
Line 1: Line 1:
 ====== PHP RFC: Attributes on Constants ====== ====== PHP RFC: Attributes on Constants ======
-  * Version: 0.1+  * Version: 0.2
   * Date: 2024-11-30   * Date: 2024-11-30
   * Author: Daniel Scherzer, daniel.e.scherzer@gmail.com   * Author: Daniel Scherzer, daniel.e.scherzer@gmail.com
-  * Status: Under Discussion+  * Status: Voting
   * First Published at: http://wiki.php.net/rfc/attributes-on-constants   * First Published at: http://wiki.php.net/rfc/attributes-on-constants
   * Implementation: https://github.com/php/php-src/pull/16952   * Implementation: https://github.com/php/php-src/pull/16952
Line 47: Line 47:
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
-New constant <php>Attribute::TARGET_CONSTANT</php> may conflict with subclasses that define such a constant of their own.+Given that <php>Attribute</php> is <php>final</php>, the added constant shouldn't cause any conflicts. Likewise, <php>ReflectionConstant</php> is final, so the added method shouldn't cause any conflicts.
  
-Since <php>ReflectionConstant</php> is <php>final</php>, the added method shouldn't cause any conflicts.+Existing attributes that use <php>Attribute::TARGET_ALL</php> may need to be updated if they do not apply to constants.
  
-Extensions that validate the usage of their attributes and use <php>Attribute::TARGET_ALL</php> may need to be updated.+Furthermore, as with all RFCs that make code that previously had a compile-time error become valid, this RFC requires updates to static analyzers and IDEs to understand the semantics of adding attributes to constants and not erroneously report errors.
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
Line 88: Line 88:
  
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
 +Voting started on 2024-12-16 and will end on 2025-01-06 00:00:00 UTC.
 +
 This vote requires a 2/3 majority to adopt. This vote requires a 2/3 majority to adopt.
 +
 +<doodle title="Support attributes on constants" auth="danielescherzer" voteType="single" closed="false" closeon="2025-01-06T00:00:00Z">
 +   * Yes
 +   * No
 +</doodle>
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
Line 104: Line 111:
   * [[rfc:shorter_attribute_syntax_change]]   * [[rfc:shorter_attribute_syntax_change]]
   * https://github.com/php/php-src/pull/16952   * https://github.com/php/php-src/pull/16952
 +
 +===== Changelog =====
 +
 +0.2:
 +
 +  * Improved discussion of backward incompatible changes
 +
 +0.1:
 +
 +  * Initial proposal
rfc/attributes-on-constants.1732985454.txt.gz · Last modified: 2024/11/30 16:50 by danielescherzer