1--TEST-- 2Trait method overrides base class method and satisfies prototype 3--FILE-- 4<?php 5error_reporting(E_ALL); 6 7abstract class Base { 8 public abstract function sayHello(array $a); 9} 10 11class SubClass extends Base { 12 public function sayHello(array $a) { 13 echo "World!\n"; 14 } 15} 16 17$s = new SubClass(); 18$s->sayHello(array()); 19 20 21trait SayWorld { 22 public function sayHello(Base $d) { 23 echo 'World!'; 24 } 25} 26 27class MyHelloWorld extends Base { 28 use SayWorld; 29} 30 31$o = new MyHelloWorld(); 32$o->sayHello(array()); 33 34?> 35--EXPECTF-- 36World! 37 38Fatal error: Declaration of SayWorld::sayHello(Base $d) must be compatible with Base::sayHello(array $a) in %s on line %d 39