rfc:dynamic_class_constant_fetch
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:dynamic_class_constant_fetch [2022/11/04 14:12] – One more example ilutov | rfc:dynamic_class_constant_fetch [2023/02/02 17:17] (current) – Move to implemented ilutov | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2022-11-04 | * Date: 2022-11-04 | ||
* Author: Ilija Tovilo, tovilo.ilija@gmail.com | * Author: Ilija Tovilo, tovilo.ilija@gmail.com | ||
- | * Status: | + | * Status: |
* Target Version: PHP 8.3 | * Target Version: PHP 8.3 | ||
* Implementation: | * Implementation: | ||
Line 53: | Line 53: | ||
==== {} expression type ==== | ==== {} expression type ==== | ||
- | The result of the expression in the braces < | + | The result of the expression in the braces < |
- | <php>Error</ | + | <php>TypeError</ |
<code php> | <code php> | ||
echo Foo::{[]}; | echo Foo::{[]}; | ||
- | // Error: Illegal offset | + | // TypeError: Cannot use value of type array as class constant name |
</ | </ | ||
Line 123: | Line 123: | ||
// Can't be demonstrated because there is no __getStatic | // Can't be demonstrated because there is no __getStatic | ||
- | // Foo:: | + | Foo:: |
// foo | // foo | ||
// Static property foo | // Static property foo | ||
// bar | // bar | ||
// Static property bar | // Static property bar | ||
- | </php> | + | </code> |
- | Property and array accesses evaluate all expressions in the chain before performing any of the actual operations. | + | Property and array accesses evaluate all expressions in the chain before performing any of the actual operations. |
- | constants, order is less relevant because it's very rare for them to be chained. Thus, the simpler approach is chosen, | + | |
- | which is evaluating | + | |
<code php> | <code php> | ||
- | // Foo:: | + | Foo:: |
// foo | // foo | ||
// Class constant foo | // Class constant foo | ||
Line 170: | Line 168: | ||
===== Vote ===== | ===== Vote ===== | ||
- | Voting starts | + | Voting starts |
As this is a language change, a 2/3 majority is required. | As this is a language change, a 2/3 majority is required. |
rfc/dynamic_class_constant_fetch.1667571143.txt.gz · Last modified: 2022/11/04 14:12 by ilutov