Skip to content

Commit cc286e5

Browse files
committed
Merge branch 'PHP-7.4'
2 parents d3ed9d8 + b964298 commit cc286e5

File tree

7 files changed

+20
-14
lines changed

7 files changed

+20
-14
lines changed

Zend/tests/object_types/return_type_reflection.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ class Two implements One {
1414
function a() : object {}
1515

1616
$returnTypeOne = (new ReflectionClass(One::class))->getMethod('a')->getReturnType();
17-
var_dump($returnTypeOne->isBuiltin(), (string)$returnTypeOne);
17+
var_dump($returnTypeOne->isBuiltin(), $returnTypeOne->getName());
1818

1919
$returnTypeTwo = (new ReflectionClass(Two::class))->getMethod('a')->getReturnType();
20-
var_dump($returnTypeTwo->isBuiltin(), (string)$returnTypeTwo);
20+
var_dump($returnTypeTwo->isBuiltin(), $returnTypeTwo->getName());
2121

2222
$returnTypea = (new ReflectionFunction('a'))->getReturnType();
23-
var_dump($returnTypea->isBuiltin(), (string)$returnTypea);
23+
var_dump($returnTypea->isBuiltin(), $returnTypea->getName());
2424
--EXPECT--
2525
bool(true)
2626
string(6) "object"

Zend/tests/object_types/type_hint_reflection.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ class Two implements One {
1414
function a(object $obj) {}
1515

1616
$typeHintOne = (new ReflectionClass(One::class))->getMethod('a')->getParameters()[0]->getType();
17-
var_dump($typeHintOne->isBuiltin(), (string)$typeHintOne);
17+
var_dump($typeHintOne->isBuiltin(), $typeHintOne->getName());
1818

1919
$typeHintTwo = (new ReflectionClass(Two::class))->getMethod('a')->getParameters()[0]->getType();
20-
var_dump($typeHintTwo->isBuiltin(), (string)$typeHintTwo);
20+
var_dump($typeHintTwo->isBuiltin(), $typeHintTwo->getName());
2121

2222
$typeHinta = (new ReflectionFunction('a'))->getParameters()[0]->getType();
23-
var_dump($typeHinta->isBuiltin(), (string)$typeHinta);
23+
var_dump($typeHinta->isBuiltin(), $typeHinta->getName());
2424
--EXPECT--
2525
bool(true)
2626
string(6) "object"

Zend/tests/type_declarations/typed_properties_018.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $reflector = new ReflectionClass(Foo::class);
1111

1212
$prop = $reflector->getProperty("qux");
1313

14-
var_dump((string) $prop->getType());
14+
var_dump($prop->getType()->getName());
1515
?>
1616
--EXPECT--
1717
string(3) "int"

ext/reflection/php_reflection.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6657,10 +6657,7 @@ static const zend_function_entry reflection_type_functions[] = {
66576657
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
66586658
ZEND_ME(reflection_type, allowsNull, arginfo_reflection__void, 0)
66596659
ZEND_ME(reflection_type, isBuiltin, arginfo_reflection__void, 0)
6660-
/* ReflectionType::__toString() is deprecated, but we currently do not mark it as such
6661-
* due to bad interaction with the PHPUnit error handler and exceptions in __toString().
6662-
* See PR2137. */
6663-
ZEND_ME(reflection_type, __toString, arginfo_reflection__void, 0)
6660+
ZEND_ME(reflection_type, __toString, arginfo_reflection__void, ZEND_ACC_DEPRECATED)
66646661
PHP_FE_END
66656662
};
66666663

ext/reflection/tests/ReflectionNamedType.phpt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,20 @@ var_dump($return->getName());
3030
var_dump((string) $return);
3131

3232
?>
33-
--EXPECT--
33+
--EXPECTF--
3434
string(11) "Traversable"
35+
36+
Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
3537
string(11) "Traversable"
3638
string(6) "string"
39+
40+
Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
3741
string(6) "string"
3842
string(4) "Test"
43+
44+
Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
3945
string(4) "Test"
4046
string(4) "Test"
47+
48+
Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
4149
string(4) "Test"

ext/reflection/tests/ReflectionType_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ $reflector = new ReflectionClass(PropTypeTest::class);
9191
foreach ($reflector->getProperties() as $name => $property) {
9292
if ($property->hasType()) {
9393
printf("public %s $%s;\n",
94-
$property->getType(), $property->getName());
94+
$property->getType()->getName(), $property->getName());
9595
} else printf("public $%s;\n", $property->getName());
9696
}
9797

ext/reflection/tests/bug72661.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ function test(iterable $arg) { }
66

77
var_dump((string)(new ReflectionParameter("test", 0))->getType());
88
?>
9-
--EXPECT--
9+
--EXPECTF--
10+
Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
1011
string(8) "iterable"

0 commit comments

Comments
 (0)