summaryrefslogtreecommitdiff
path: root/Zend/tests/nullable_types/contravariant_nullable_return_fails.phpt
blob: c9be479ead34c9cc069e7dc65cc12e5d9ef5fc3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--TEST--
Return type cannot add nullability (contravariance)

--FILE--
<?php

interface A {
    function method(): int;
}

interface B extends A {
    function method(): ?int;
}

--EXPECTF--
Fatal error: Declaration of B::method(): ?int must be compatible with A::method(): int in %s on line %d