diff options
author | Tyson Andre <tysonandre775@hotmail.com> | 2020-04-21 19:19:53 -0400 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-04-22 15:24:35 +0200 |
commit | 630897f9962e734f027e2e277b00f8b4db89ef5c (patch) | |
tree | 3ed28b110bdf719e7886e6021a24b3ed6a4c57e4 | |
parent | c33e5043a855db87699529348e465c1f5c6e65b8 (diff) | |
download | php-git-630897f9962e734f027e2e277b00f8b4db89ef5c.tar.gz |
Document change to ReflectionMethod->isConstructor/isDestructor
See https://externals.io/message/109377
This prevented PHPUnit's test doubles from being created for interfaces.
The reason this changed is
https://github.com/php/php-src/pull/3846/files#diff-3a8139128d4026ce0cb0c86beba4e6b9L5549-R5605
(ReflectionMethod::isConstruct checks if the method is the zend_class_entry's
constructor, etc.)
-rw-r--r-- | UPGRADING | 5 | ||||
-rw-r--r-- | ext/reflection/tests/ReflectionMethod_basic1.phpt | 128 |
2 files changed, 132 insertions, 1 deletions
@@ -192,7 +192,7 @@ PHP 8.0 UPGRADE NOTES - dom: . Remove unimplemented classes from ext/dom that had no behavior and contained test data. These classes have also been removed in the latest version of DOM - standard: + standard: * DOMNameList * DomImplementationList @@ -325,6 +325,9 @@ PHP 8.0 UPGRADE NOTES ReflectionParameter::getDefaultValue() ReflectionParameter::isDefaultValueConstant() ReflectionParameter::getDefaultValueConstantName() + . ReflectionMethod::isConstructor() and ReflectionMethod::isDestructor() now + also return true for `__construct` and `__destruct` in methods of interfaces. + Previously, this would only be true in methods of classes and traits. - Socket: . The deprecated AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES diff --git a/ext/reflection/tests/ReflectionMethod_basic1.phpt b/ext/reflection/tests/ReflectionMethod_basic1.phpt index 8eb970babb..e065d28ec6 100644 --- a/ext/reflection/tests/ReflectionMethod_basic1.phpt +++ b/ext/reflection/tests/ReflectionMethod_basic1.phpt @@ -49,6 +49,14 @@ class DerivedClass extends TestClass {} interface TestInterface { public function int(); + public function __construct($arg); + public function __destruct(); +} + +trait TestTrait { + public abstract function __construct(); + public function __destruct() { + } } reflectMethod("DerivedClass", "foo"); @@ -59,6 +67,10 @@ reflectMethod("DerivedClass", "prot"); reflectMethod("TestInterface", "int"); reflectMethod("ReflectionProperty", "__construct"); reflectMethod("TestClass", "__destruct"); +reflectMethod("TestInterface", "__construct"); +reflectMethod("TestInterface", "__destruct"); +reflectMethod("TestTrait", "__construct"); +reflectMethod("TestTrait", "__destruct"); ?> --EXPECT-- @@ -294,3 +306,119 @@ isDestructor(): bool(true) ********************************** +********************************** +Reflecting on method TestInterface::__construct() + + +isFinal(): +bool(false) + +isAbstract(): +bool(true) + +isPublic(): +bool(true) + +isPrivate(): +bool(false) + +isProtected(): +bool(false) + +isStatic(): +bool(false) + +isConstructor(): +bool(true) + +isDestructor(): +bool(false) + +********************************** +********************************** +Reflecting on method TestInterface::__destruct() + + +isFinal(): +bool(false) + +isAbstract(): +bool(true) + +isPublic(): +bool(true) + +isPrivate(): +bool(false) + +isProtected(): +bool(false) + +isStatic(): +bool(false) + +isConstructor(): +bool(false) + +isDestructor(): +bool(true) + +********************************** +********************************** +Reflecting on method TestTrait::__construct() + + +isFinal(): +bool(false) + +isAbstract(): +bool(true) + +isPublic(): +bool(true) + +isPrivate(): +bool(false) + +isProtected(): +bool(false) + +isStatic(): +bool(false) + +isConstructor(): +bool(true) + +isDestructor(): +bool(false) + +********************************** +********************************** +Reflecting on method TestTrait::__destruct() + + +isFinal(): +bool(false) + +isAbstract(): +bool(false) + +isPublic(): +bool(true) + +isPrivate(): +bool(false) + +isProtected(): +bool(false) + +isStatic(): +bool(false) + +isConstructor(): +bool(false) + +isDestructor(): +bool(true) + +********************************** |