blob: bb53411cad618862bb1f3c217c361c867f8f9275 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
--TEST--
Inheritance of union type from internal class
--SKIPIF--
<?php
if (!extension_loaded('zend-test')) die('skip requires zend-test extension');
?>
--FILE--
<?php
class C extends _ZendTestClass {}
$obj = new _ZendTestChildClass;
$obj->classUnionProp = new stdClass;
$obj->classUnionProp = new ArrayIterator;
try {
$obj->classUnionProp = new DateTime;
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
$obj = new C;
$obj->classUnionProp = new stdClass;
$obj->classUnionProp = new ArrayIterator;
try {
$obj->classUnionProp = new DateTime;
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Cannot assign DateTime to property _ZendTestClass::$classUnionProp of type stdClass|Iterator|null
Cannot assign DateTime to property _ZendTestClass::$classUnionProp of type stdClass|Iterator|null
|