1--TEST--
2Test that internal classes can register intersection types
3--EXTENSIONS--
4zend_test
5spl
6--FILE--
7<?php
8
9class C implements Countable {
10    public function count(): int {
11        return 1;
12    }
13}
14
15class I extends EmptyIterator implements Countable {
16    public function count(): int {
17        return 1;
18    }
19}
20
21$o = new _ZendTestClass();
22
23try {
24    var_dump($o->classIntersectionProp);
25} catch (Error $e) {
26    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
27}
28try {
29    $o->classIntersectionProp = new EmptyIterator();
30} catch (TypeError $e) {
31    echo $e->getMessage(), PHP_EOL;
32}
33try {
34    $o->classIntersectionProp = new C();
35} catch (TypeError $e) {
36    echo $e->getMessage(), PHP_EOL;
37}
38$o->classIntersectionProp = new I();
39
40?>
41==DONE==
42--EXPECT--
43Error: Typed property _ZendTestClass::$classIntersectionProp must not be accessed before initialization
44Cannot assign EmptyIterator to property _ZendTestClass::$classIntersectionProp of type Traversable&Countable
45Cannot assign C to property _ZendTestClass::$classIntersectionProp of type Traversable&Countable
46==DONE==
47