1--TEST--
2Test get_debug_type() class reading
3--FILE--
4<?php
5
6namespace Demo {
7    class ClassInNamespace {
8
9    }
10}
11
12namespace {
13    class ClassInGlobal { }
14
15    class ToBeExtended {  }
16    interface ToBeImplemented { }
17
18    $fp = fopen(__FILE__, 'r');
19
20    $fp_closed = fopen(__FILE__, 'r');
21    fclose($fp_closed);
22
23    /* tests against an object type */
24    echo get_debug_type(new ClassInGlobal()) . "\n";
25    echo get_debug_type(new Demo\ClassInNamespace()) . "\n";
26    echo get_debug_type(new class {}) . "\n";
27    echo get_debug_type(new class extends ToBeExtended {}) . "\n";
28    echo get_debug_type(new class implements ToBeImplemented {}) . "\n";
29
30    /* scalars */
31    echo get_debug_type("foo") . "\n";
32    echo get_debug_type(false) . "\n";
33    echo get_debug_type(true) . "\n";
34    echo get_debug_type(1) . "\n";
35    echo get_debug_type(1.1) . "\n";
36    echo get_debug_type([]) . "\n";
37    echo get_debug_type(null) . "\n";
38    echo get_debug_type($fp) . "\n";
39    echo get_debug_type($fp_closed) . "\n";
40
41}
42
43?>
44--EXPECT--
45ClassInGlobal
46Demo\ClassInNamespace
47class@anonymous
48ToBeExtended@anonymous
49ToBeImplemented@anonymous
50string
51bool
52bool
53int
54float
55array
56null
57resource (stream)
58resource (closed)
59