summaryrefslogtreecommitdiff
path: root/Zend/tests/grammar/semi_reserved_008.phpt
blob: f48c459671ea447716591372225f01896426de49 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--TEST--
Testing with comments around semi-reserved names (not intended to be legible)
--FILE--
<?php

trait TraitA
{
    public static function list(){ echo __METHOD__, PHP_EOL; }
    public static function /* comment */ catch(){ echo __METHOD__, PHP_EOL; }
    private static function // comment
        throw(){ echo __METHOD__, PHP_EOL; }
    private static function
    # comment
    self(){ echo __METHOD__, PHP_EOL; }
}

trait TraitB
{
    public static function exit(){ echo __METHOD__, PHP_EOL; }
    protected static function try(){ echo __METHOD__, PHP_EOL; }
}

class Foo
{
    use TraitA {
        TraitA::
            //
            /** doc comment */
            #
        catch /* comment */
            // comment
            # comment
        insteadof TraitB;

        TraitA::list as public /**/ foreach;
    }

    use TraitB {
        try /*comment*/ as public attempt;
        exit // comment
            as/*comment*/die; // non qualified
        \TraitB::exit as bye; // full qualified
        namespace\TraitB::exit #
        as byebye; // even more full qualified
        TraitB
            ::
            /**  */
            exit as farewell; // full qualified with weird spacing
    }
}

Foo /**/
#
//
/**  */
::
/**/
#
//
/**  */
attempt();

echo PHP_EOL, "Done", PHP_EOL;
--EXPECTF--
TraitB::try

Done