summaryrefslogtreecommitdiff
path: root/Zend/tests/nullable_types/invariant_param_and_return_succeeds.phpt
blob: 6ddad67bb843157ad931bb8861953d90f7131c0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--TEST--
Invariant parameter and return types work with nullable types
--FILE--
<?php

interface A {
    function method(?int $i): ?int;
}

class B implements A {
    function method(?int $i): ?int {
        return $i;
    }
}

$b = new B();
var_dump($b->method(null));
var_dump($b->method(1));
--EXPECT--
NULL
int(1)