summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/rfc003.phpt
blob: 6b9cc81c6993130b761eb70d488887ae33ffcb95 (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: Return value of foo() must be an instance of DateTime, null returned in %s:%d
Stack trace:
#0 %s(%d): foo()
#1 {main}
  thrown in %s on line %d