mirror of
https://github.com/php/php-src.git
synced 2024-12-03 23:05:57 +08:00
Make class constants fully dereferencable
This commit is contained in:
parent
de7c7efee9
commit
ab154b7a64
27
Zend/tests/varSyntax/class_constant_static_deref.phpt
Normal file
27
Zend/tests/varSyntax/class_constant_static_deref.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Class constants can be used as a class name
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
const NAME = 'Test2';
|
||||
}
|
||||
|
||||
class Test2 {
|
||||
const FOO = 42;
|
||||
public static $foo = 42;
|
||||
|
||||
public static function foo() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
var_dump(Test::NAME::FOO);
|
||||
var_dump(Test::NAME::$foo);
|
||||
var_dump(Test::NAME::foo());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(42)
|
||||
int(42)
|
||||
int(42)
|
@ -1150,12 +1150,12 @@ fully_dereferencable:
|
||||
variable { $$ = $1; }
|
||||
| '(' expr ')' { $$ = $2; }
|
||||
| dereferencable_scalar { $$ = $1; }
|
||||
| class_constant { $$ = $1; }
|
||||
;
|
||||
|
||||
array_object_dereferencable:
|
||||
fully_dereferencable { $$ = $1; }
|
||||
| constant { $$ = $1; }
|
||||
| class_constant { $$ = $1; }
|
||||
;
|
||||
|
||||
callable_expr:
|
||||
|
Loading…
Reference in New Issue
Block a user