summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/rfc003.phpt
blob: 461d80b7fe8329024367370b7d64b0453bbcde0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--TEST--
RFC example: cannot return null with a return type declaration
--FILE--
<?php
function foo(): DateTime {
    return null;
}

foo();
--EXPECTF--
Fatal error: Uncaught TypeError: foo(): Return value must be of type DateTime, null returned in %s:%d
Stack trace:
#0 %s(%d): foo()
#1 {main}
  thrown in %s on line %d