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