1--TEST-- 2ZE2 An interface extends base interfaces 3--FILE-- 4<?php 5 6interface if_a { 7 function f_a(); 8} 9 10interface if_b { 11 function f_b(); 12} 13 14interface if_c extends if_a, if_b { 15 function f_c(); 16} 17 18interface if_d extends if_a, if_b { 19 function f_d(); 20} 21 22interface if_e { 23 function f_d(); 24} 25 26interface if_f extends /*if_e,*/ if_a, if_b, if_c, if_d /*, if_e*/ { 27} 28 29class base { 30 function test($class) { 31 echo "is_a(" . get_class($this) . ", $class) ". (($this instanceof $class) ? "yes\n" : "no\n"); 32 } 33} 34 35echo "class_a\n"; 36 37class class_a extends base implements if_a { 38 function f_a() {} 39 function f_b() {} 40 function f_c() {} 41 function f_d() {} 42 function f_e() {} 43} 44 45$t = new class_a(); 46echo $t->test('if_a'); 47echo $t->test('if_b'); 48echo $t->test('if_c'); 49echo $t->test('if_d'); 50echo $t->test('if_e'); 51 52echo "class_b\n"; 53 54class class_b extends base implements if_a, if_b { 55 function f_a() {} 56 function f_b() {} 57 function f_c() {} 58 function f_d() {} 59 function f_e() {} 60} 61 62$t = new class_b(); 63echo $t->test('if_a'); 64echo $t->test('if_b'); 65echo $t->test('if_c'); 66echo $t->test('if_d'); 67echo $t->test('if_e'); 68 69echo "class_c\n"; 70 71class class_c extends base implements if_c { 72 function f_a() {} 73 function f_b() {} 74 function f_c() {} 75 function f_d() {} 76 function f_e() {} 77} 78 79$t = new class_c(); 80echo $t->test('if_a'); 81echo $t->test('if_b'); 82echo $t->test('if_c'); 83echo $t->test('if_d'); 84echo $t->test('if_e'); 85 86echo "class_d\n"; 87 88class class_d extends base implements if_d{ 89 function f_a() {} 90 function f_b() {} 91 function f_c() {} 92 function f_d() {} 93 function f_e() {} 94} 95 96$t = new class_d(); 97echo $t->test('if_a'); 98echo $t->test('if_b'); 99echo $t->test('if_c'); 100echo $t->test('if_d'); 101echo $t->test('if_e'); 102 103echo "class_e\n"; 104 105class class_e extends base implements if_a, if_b, if_c, if_d { 106 function f_a() {} 107 function f_b() {} 108 function f_c() {} 109 function f_d() {} 110 function f_e() {} 111} 112 113$t = new class_e(); 114echo $t->test('if_a'); 115echo $t->test('if_b'); 116echo $t->test('if_c'); 117echo $t->test('if_d'); 118echo $t->test('if_e'); 119 120echo "class_f\n"; 121 122class class_f extends base implements if_e { 123 function f_a() {} 124 function f_b() {} 125 function f_c() {} 126 function f_d() {} 127 function f_e() {} 128} 129 130$t = new class_f(); 131echo $t->test('if_a'); 132echo $t->test('if_b'); 133echo $t->test('if_c'); 134echo $t->test('if_d'); 135echo $t->test('if_e'); 136 137echo "class_g\n"; 138 139class class_g extends base implements if_f { 140 function f_a() {} 141 function f_b() {} 142 function f_c() {} 143 function f_d() {} 144 function f_e() {} 145} 146 147$t = new class_g(); 148echo $t->test('if_a'); 149echo $t->test('if_b'); 150echo $t->test('if_c'); 151echo $t->test('if_d'); 152echo $t->test('if_e'); 153 154?> 155===DONE=== 156--EXPECT-- 157class_a 158is_a(class_a, if_a) yes 159is_a(class_a, if_b) no 160is_a(class_a, if_c) no 161is_a(class_a, if_d) no 162is_a(class_a, if_e) no 163class_b 164is_a(class_b, if_a) yes 165is_a(class_b, if_b) yes 166is_a(class_b, if_c) no 167is_a(class_b, if_d) no 168is_a(class_b, if_e) no 169class_c 170is_a(class_c, if_a) yes 171is_a(class_c, if_b) yes 172is_a(class_c, if_c) yes 173is_a(class_c, if_d) no 174is_a(class_c, if_e) no 175class_d 176is_a(class_d, if_a) yes 177is_a(class_d, if_b) yes 178is_a(class_d, if_c) no 179is_a(class_d, if_d) yes 180is_a(class_d, if_e) no 181class_e 182is_a(class_e, if_a) yes 183is_a(class_e, if_b) yes 184is_a(class_e, if_c) yes 185is_a(class_e, if_d) yes 186is_a(class_e, if_e) no 187class_f 188is_a(class_f, if_a) no 189is_a(class_f, if_b) no 190is_a(class_f, if_c) no 191is_a(class_f, if_d) no 192is_a(class_f, if_e) yes 193class_g 194is_a(class_g, if_a) yes 195is_a(class_g, if_b) yes 196is_a(class_g, if_c) yes 197is_a(class_g, if_d) yes 198is_a(class_g, if_e) no 199===DONE=== 200