mirror of
https://github.com/php/php-src.git
synced 2025-01-27 06:03:45 +08:00
45 lines
583 B
PHP
45 lines
583 B
PHP
--TEST--
|
|
Test to ensure semi reserved words allow deference
|
|
--FILE--
|
|
<?php
|
|
|
|
class Foo {
|
|
const use = 'yay';
|
|
|
|
public static function new() {
|
|
echo __METHOD__, PHP_EOL;
|
|
return new static();
|
|
}
|
|
|
|
public function self() {
|
|
echo __METHOD__, PHP_EOL;
|
|
return $this;
|
|
}
|
|
}
|
|
|
|
Foo::new()::new()::new();
|
|
|
|
var_dump(
|
|
(new Foo)->self()::new()->self()->self()::use
|
|
);
|
|
|
|
Foo::{'new'}();
|
|
|
|
var_dump(Foo::use);
|
|
|
|
echo "\nDone\n";
|
|
|
|
--EXPECTF--
|
|
Foo::new
|
|
Foo::new
|
|
Foo::new
|
|
Foo::self
|
|
Foo::new
|
|
Foo::self
|
|
Foo::self
|
|
string(3) "yay"
|
|
Foo::new
|
|
string(3) "yay"
|
|
|
|
Done
|