summaryrefslogtreecommitdiff
path: root/Zend/tests/grammar/regression_007.phpt
blob: 92b22531a45a17e55d357500c35360a782fa6d95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--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