summaryrefslogtreecommitdiff
path: root/Zend/tests/traits/bug55554b.phpt
blob: 06229bac340433ba83b110df7db96ae44c730c6a (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
--TEST--
Bug #55137 (Legacy constructor not registered for class)
--FILE--
<?php

trait TConstructor {
    public function foo() {
        echo "foo executed\n";
    }
    public function bar() {
        echo "bar executed\n";
    }
}

class OverridingIsSilent1 {
    use TConstructor {
	    foo as __construct;
	}
	
	public function __construct() {
	    echo "OverridingIsSilent1 __construct\n";
	}
}

$o = new OverridingIsSilent1;

class OverridingIsSilent2 {
    use TConstructor {
	    foo as OverridingIsSilent2;
	}
	
	public function OverridingIsSilent2() {
	    echo "OverridingIsSilent2 OverridingIsSilent2\n";
	}
}

$o = new OverridingIsSilent2;

class ReportCollision {
	use TConstructor {
	    bar as ReportCollision;
	    foo as __construct;
	}
}


echo "ReportCollision: ";
$o = new ReportCollision;


--EXPECTF--
OverridingIsSilent1 __construct

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OverridingIsSilent2 has a deprecated constructor in %s on line %d
OverridingIsSilent2 OverridingIsSilent2

Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d