summaryrefslogtreecommitdiff
path: root/Zend/tests/traits/inheritance003.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/traits/inheritance003.phpt')
-rw-r--r--Zend/tests/traits/inheritance003.phpt38
1 files changed, 38 insertions, 0 deletions
diff --git a/Zend/tests/traits/inheritance003.phpt b/Zend/tests/traits/inheritance003.phpt
new file mode 100644
index 0000000000..ba2e4da76d
--- /dev/null
+++ b/Zend/tests/traits/inheritance003.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Trait method overriddes base class method and satisfies prototype
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+abstract class Base {
+ public abstract function sayHello(array $a);
+}
+
+class SubClass extends Base {
+ public function sayHello(array $a) {
+ echo "World!\n";
+ }
+}
+
+$s = new SubClass();
+$s->sayHello(array());
+
+
+trait SayWorld {
+ public function sayHello(Base $d) {
+ echo 'World!';
+ }
+}
+
+class MyHelloWorld extends Base {
+ use SayWorld;
+}
+
+$o = new MyHelloWorld();
+$o->sayHello(array());
+
+?>
+--EXPECTF--
+World!
+
+Fatal error: Declaration of MyHelloWorld::sayHello() must be compatible with that of Base::sayHello() in %s on line %d