com php-src: Added tests demonstrating the same effect with abstracts: Zend/tests/bug73987.phpt Zend/tests/bug73987_1. phpt Zend/tests/bug73987_2.phpt
Zend/tests/ bug73987_3.phpt
| From: | Joe Watkins | Date: | Sat, 28 Jan 2017 06:28:14 +0000 |
| Subject: | com php-src: Added tests demonstrating the same effect with abstracts: Zend/tests/bug73987.phpt Zend/tests/bug73987_1. phpt Zend/tests/bug73987_2.phpt Zend/tests/ bug73987_3.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96889@lists.php.net to get a copy of this message | ||
Commit: c11b2b809d349399c8f4b54c6bf24078dece455e
Author: Pedro Magalhães <mail@pmmaga.net> Fri, 27 Jan 2017 19:44:46 +0100
Committer: Joe Watkins <krakjoe@php.net> Sat, 28 Jan 2017 06:28:14 +0000
Parents: b67eb3440bb244adf6957bf2c68aeeaa6efc8c8d
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c11b2b809d349399c8f4b54c6bf24078dece455e
Log:
Added tests demonstrating the same effect with abstracts
Changed paths:
M Zend/tests/bug73987.phpt
M Zend/tests/bug73987_1.phpt
A Zend/tests/bug73987_2.phpt
A Zend/tests/bug73987_3.phpt
Diff:
diff --git a/Zend/tests/bug73987.phpt b/Zend/tests/bug73987.phpt
index 5515656..610b594 100644
--- a/Zend/tests/bug73987.phpt
+++ b/Zend/tests/bug73987.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #73987 (Method compatibility check looks to original definition and not parent)
+Bug #73987 (Method compatibility check looks to original definition and not parent - nullability
interface)
--FILE--
<?php
diff --git a/Zend/tests/bug73987_1.phpt b/Zend/tests/bug73987_1.phpt
index 6a0a157..010987e 100644
--- a/Zend/tests/bug73987_1.phpt
+++ b/Zend/tests/bug73987_1.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #73987 (Method compatibility check looks to original definition and not parent)
+Bug #73987 (Method compatibility check looks to original definition and not parent - return types
interface)
--FILE--
<?php
diff --git a/Zend/tests/bug73987_2.phpt b/Zend/tests/bug73987_2.phpt
new file mode 100644
index 0000000..a70f145
--- /dev/null
+++ b/Zend/tests/bug73987_2.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #73987 (Method compatibility check looks to original definition and not parent - nullabilty
abstract)
+--FILE--
+<?php
+
+abstract class A {
+ abstract function example($a, $b, $c);
+}
+
+class B extends A {
+ function example($a, $b = null, $c = null) { }
+}
+
+class C extends B {
+ function example($a, $b, $c = null) { }
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of C::example($a, $b, $c = NULL) must be compatible with B::example($a, $b
= NULL, $c = NULL) in %s
diff --git a/Zend/tests/bug73987_3.phpt b/Zend/tests/bug73987_3.phpt
new file mode 100644
index 0000000..89e4686
--- /dev/null
+++ b/Zend/tests/bug73987_3.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #73987 (Method compatibility check looks to original definition and not parent - return types
abstract)
+--FILE--
+<?php
+
+abstract class A {
+ abstract function example();
+}
+
+class B extends A {
+ function example(): int { }
+}
+
+class C extends B {
+ function example(): string { }
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of C::example(): string must be compatible with B::example(): int in %s