Annotation of embedaddon/php/Zend/tests/traits/bug55554b.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #55137 (Legacy constructor not registered for class)
3: --FILE--
4: <?php
5:
6: trait TConstructor {
7: public function foo() {
8: echo "foo executed\n";
9: }
10: public function bar() {
11: echo "bar executed\n";
12: }
13: }
14:
15: class OverridingIsSilent1 {
16: use TConstructor {
17: foo as __construct;
18: }
19:
20: public function __construct() {
21: echo "OverridingIsSilent1 __construct\n";
22: }
23: }
24:
25: $o = new OverridingIsSilent1;
26:
27: class OverridingIsSilent2 {
28: use TConstructor {
29: foo as OverridingIsSilent2;
30: }
31:
32: public function OverridingIsSilent2() {
33: echo "OverridingIsSilent2 OverridingIsSilent2\n";
34: }
35: }
36:
37: $o = new OverridingIsSilent2;
38:
39: class ReportCollision {
40: use TConstructor {
41: bar as ReportCollision;
42: foo as __construct;
43: }
44: }
45:
46:
47: echo "ReportCollision: ";
48: $o = new ReportCollision;
49:
50:
51: --EXPECTF--
52: OverridingIsSilent1 __construct
53: OverridingIsSilent2 OverridingIsSilent2
54:
55: Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d
56:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>