summaryrefslogtreecommitdiff
path: root/Zend/tests/traits
diff options
context:
space:
mode:
authorStefan Marr <gron@php.net>2011-11-01 13:42:53 +0000
committerStefan Marr <gron@php.net>2011-11-01 13:42:53 +0000
commit9b0d73af1d8a59f48336bc60513f44edd4d4c34d (patch)
treea8cd6afcd8be342c6a122bea63969b83b655da11 /Zend/tests/traits
parentceac9dc4902795ee615d9e089a29434bd77c4cdb (diff)
downloadphp-git-9b0d73af1d8a59f48336bc60513f44edd4d4c34d.tar.gz
Added missing consistency check for abstract methods required by one trait and implemented by another.
Diffstat (limited to 'Zend/tests/traits')
-rw-r--r--Zend/tests/traits/bugs/abstract-methods05.phpt25
-rw-r--r--Zend/tests/traits/bugs/abstract-methods06.phpt26
2 files changed, 51 insertions, 0 deletions
diff --git a/Zend/tests/traits/bugs/abstract-methods05.phpt b/Zend/tests/traits/bugs/abstract-methods05.phpt
new file mode 100644
index 0000000000..e90ce39a32
--- /dev/null
+++ b/Zend/tests/traits/bugs/abstract-methods05.phpt
@@ -0,0 +1,25 @@
+--TEST--
+The compatibility with the signature of abstract methods should be checked.
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+trait THelloB {
+ public function hello() {
+ echo 'Hello';
+ }
+}
+
+trait THelloA {
+ public abstract function hello($a);
+}
+
+class TraitsTest1 {
+ use THelloB;
+ use THelloA;
+}
+
+
+?>
+--EXPECTF--
+Fatal error: Declaration of THelloB::hello() must be compatible with THelloA::hello($a) in %s on line %d \ No newline at end of file
diff --git a/Zend/tests/traits/bugs/abstract-methods06.phpt b/Zend/tests/traits/bugs/abstract-methods06.phpt
new file mode 100644
index 0000000000..fdcd816961
--- /dev/null
+++ b/Zend/tests/traits/bugs/abstract-methods06.phpt
@@ -0,0 +1,26 @@
+--TEST--
+The compatibility with the signature of abstract methods should be checked. (also checking the second possible implementation branch)
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+trait THelloB {
+ public function hello() {
+ echo 'Hello';
+ }
+}
+
+trait THelloA {
+ public abstract function hello($a);
+}
+
+class TraitsTest1 {
+ use THelloA;
+ use THelloB;
+}
+
+
+
+?>
+--EXPECTF--
+Fatal error: Declaration of THelloB::hello() must be compatible with THelloA::hello($a) in %s on line %d \ No newline at end of file