source: src/router/php7/Zend/tests/nullable_types/invariant_param_and_return_succeeds.phpt @ 31874

Last change on this file since 31874 was 31874, checked in by brainslayer, 3 months ago

update php

File size: 321 bytes
Line 
1--TEST--
2Invariant parameter and return types work with nullable types
3
4--FILE--
5<?php
6
7interface A {
8    function method(?int $i): ?int;
9}
10
11class B implements A {
12    function method(?int $i): ?int {
13        return $i;
14    }
15}
16
17$b = new B();
18var_dump($b->method(null));
19var_dump($b->method(1));
20
21--EXPECT--
22NULL
23int(1)
24
Note: See TracBrowser for help on using the repository browser.