source: src/router/php7/Zend/tests/return_types/030.phpt @ 31874

Last change on this file since 31874 was 31874, checked in by brainslayer, 6 weeks ago

update php

File size: 368 bytes
Line 
1--TEST--
2Nullable return value
3--FILE--
4<?php
5function foo($x) : ?array {
6        return $x;
7}
8
9foo([]);
10echo "ok\n";
11foo(null);
12echo "ok\n";
13foo(0);
14?>
15--EXPECTF--
16ok
17ok
18
19Fatal error: Uncaught TypeError: Return value of foo() must be of the type array or null, integer returned in %s030.php:3
20Stack trace:
21#0 %s030.php(10): foo(0)
22#1 {main}
23  thrown in %s030.php on line 3
Note: See TracBrowser for help on using the repository browser.