summaryrefslogtreecommitdiff
path: root/Zend/tests/nullsafe_operator/002.phpt
blob: 46c1bb623f6e5bd1eff1afe8af130e879c5e5554 (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
34
35
36
37
38
39
40
41
42
--TEST--
Test nullsafe strict type check
--FILE--
<?php

try {
    false?->bar();
} catch (Throwable $e) {
    var_dump($e->getMessage());
}

try {
    []?->bar();
} catch (Throwable $e) {
    var_dump($e->getMessage());
}

try {
    (0)?->bar();
} catch (Throwable $e) {
    var_dump($e->getMessage());
}

try {
    (0.0)?->bar();
} catch (Throwable $e) {
    var_dump($e->getMessage());
}

try {
    ''?->bar();
} catch (Throwable $e) {
    var_dump($e->getMessage());
}

?>
--EXPECT--
string(39) "Call to a member function bar() on bool"
string(40) "Call to a member function bar() on array"
string(38) "Call to a member function bar() on int"
string(40) "Call to a member function bar() on float"
string(41) "Call to a member function bar() on string"