Commit af8d07f
committed
[WIP] Support 'static const CONST_NAME = expr;'
Currently, this is limited to the global scope.
This can be thought of as similar to C:
the static const can only be seen within the namespace block scope.
Differences from const:
- This can only be declared once per namespace block,
and has can only be used by following statements in the namespace block.
- Supporting any expression (function calls, expr, etc.) in the value is planned.
**Not implemented yet**
- Eagerly evaluated when the expression might be dynamic.
This is meant to make accidental infinite recursion less likely.
This may throw in the future.
The planned implementation will be shorthand for:
```
if (!defined('UNIQUE_NAME_FOR_LOCAL_X')) {
define('UNIQUE_NAME_FOR_LOCAL_X', "Local value");
}
class Example {
const X = \LOCAL_NAME_FOR_LOCAL_X;
}
```
```php
static const LOCAL_X = "Local value";
class Example {
const X = LOCAL_X;
}
```1 parent 0f89d40 commit af8d07f
File tree
5 files changed
+109
-1
lines changed- Zend
5 files changed
+109
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1540 | 1540 | | |
1541 | 1541 | | |
1542 | 1542 | | |
| 1543 | + | |
1543 | 1544 | | |
1544 | 1545 | | |
1545 | 1546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| 365 | + | |
365 | 366 | | |
366 | 367 | | |
367 | 368 | | |
| |||
835 | 836 | | |
836 | 837 | | |
837 | 838 | | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
838 | 862 | | |
839 | 863 | | |
840 | 864 | | |
| |||
847 | 871 | | |
848 | 872 | | |
849 | 873 | | |
| 874 | + | |
850 | 875 | | |
851 | 876 | | |
852 | 877 | | |
853 | 878 | | |
854 | 879 | | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
855 | 895 | | |
856 | 896 | | |
857 | 897 | | |
| |||
6947 | 6987 | | |
6948 | 6988 | | |
6949 | 6989 | | |
| 6990 | + | |
| 6991 | + | |
| 6992 | + | |
| 6993 | + | |
| 6994 | + | |
| 6995 | + | |
| 6996 | + | |
| 6997 | + | |
| 6998 | + | |
| 6999 | + | |
| 7000 | + | |
| 7001 | + | |
| 7002 | + | |
| 7003 | + | |
| 7004 | + | |
| 7005 | + | |
| 7006 | + | |
| 7007 | + | |
| 7008 | + | |
| 7009 | + | |
| 7010 | + | |
| 7011 | + | |
| 7012 | + | |
| 7013 | + | |
| 7014 | + | |
| 7015 | + | |
| 7016 | + | |
| 7017 | + | |
| 7018 | + | |
| 7019 | + | |
| 7020 | + | |
| 7021 | + | |
| 7022 | + | |
| 7023 | + | |
| 7024 | + | |
| 7025 | + | |
| 7026 | + | |
| 7027 | + | |
| 7028 | + | |
| 7029 | + | |
| 7030 | + | |
| 7031 | + | |
| 7032 | + | |
| 7033 | + | |
| 7034 | + | |
| 7035 | + | |
| 7036 | + | |
| 7037 | + | |
| 7038 | + | |
| 7039 | + | |
| 7040 | + | |
| 7041 | + | |
| 7042 | + | |
| 7043 | + | |
| 7044 | + | |
6950 | 7045 | | |
6951 | 7046 | | |
6952 | 7047 | | |
| |||
7011 | 7106 | | |
7012 | 7107 | | |
7013 | 7108 | | |
| 7109 | + | |
7014 | 7110 | | |
7015 | 7111 | | |
7016 | 7112 | | |
| |||
8706 | 8802 | | |
8707 | 8803 | | |
8708 | 8804 | | |
| 8805 | + | |
| 8806 | + | |
| 8807 | + | |
8709 | 8808 | | |
8710 | 8809 | | |
8711 | 8810 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
| 247 | + | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| 337 | + | |
337 | 338 | | |
338 | 339 | | |
339 | 340 | | |
| |||
403 | 404 | | |
404 | 405 | | |
405 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
406 | 412 | | |
407 | 413 | | |
408 | 414 | | |
| |||
0 commit comments