summaryrefslogtreecommitdiff
path: root/ext/reflection/tests
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-06-05 15:33:52 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-06-05 15:33:52 +0200
commitb964298c19c685f61542bbf30c49bd164b67c653 (patch)
treee21bed75dd12b603b88440bf1abb98b67aba40c3 /ext/reflection/tests
parenta31f46421d7bf6f55dd9ac5876b8e2eacf7e0708 (diff)
downloadphp-git-b964298c19c685f61542bbf30c49bd164b67c653.tar.gz
Deprecate ReflectionType::__toString()
We weren't able to do this in 7.1 because the deprecation notice may be converted to an exception and __toString() can't throw, which means that it ultimately become a fatal error. This issue is resolved now, so we can mark the method as deprecated.
Diffstat (limited to 'ext/reflection/tests')
-rw-r--r--ext/reflection/tests/ReflectionNamedType.phpt10
-rw-r--r--ext/reflection/tests/ReflectionType_001.phpt2
-rw-r--r--ext/reflection/tests/bug72661.phpt3
3 files changed, 12 insertions, 3 deletions
diff --git a/ext/reflection/tests/ReflectionNamedType.phpt b/ext/reflection/tests/ReflectionNamedType.phpt
index a40d4066ec..afb592127c 100644
--- a/ext/reflection/tests/ReflectionNamedType.phpt
+++ b/ext/reflection/tests/ReflectionNamedType.phpt
@@ -30,12 +30,20 @@ var_dump($return->getName());
var_dump((string) $return);
?>
---EXPECT--
+--EXPECTF--
string(11) "Traversable"
+
+Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
string(11) "Traversable"
string(6) "string"
+
+Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
string(6) "string"
string(4) "Test"
+
+Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
string(4) "Test"
string(4) "Test"
+
+Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
string(4) "Test"
diff --git a/ext/reflection/tests/ReflectionType_001.phpt b/ext/reflection/tests/ReflectionType_001.phpt
index e47a9615ba..1eb521317c 100644
--- a/ext/reflection/tests/ReflectionType_001.phpt
+++ b/ext/reflection/tests/ReflectionType_001.phpt
@@ -91,7 +91,7 @@ $reflector = new ReflectionClass(PropTypeTest::class);
foreach ($reflector->getProperties() as $name => $property) {
if ($property->hasType()) {
printf("public %s $%s;\n",
- $property->getType(), $property->getName());
+ $property->getType()->getName(), $property->getName());
} else printf("public $%s;\n", $property->getName());
}
diff --git a/ext/reflection/tests/bug72661.phpt b/ext/reflection/tests/bug72661.phpt
index b1cb764beb..46ba048078 100644
--- a/ext/reflection/tests/bug72661.phpt
+++ b/ext/reflection/tests/bug72661.phpt
@@ -6,5 +6,6 @@ function test(iterable $arg) { }
var_dump((string)(new ReflectionParameter("test", 0))->getType());
?>
---EXPECT--
+--EXPECTF--
+Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
string(8) "iterable"