summaryrefslogtreecommitdiff
path: root/Zend/tests/nullable_types/contravariant_nullable_return_fails.phpt
blob: fe6ebc565433f94747c170e26abc77b225a713c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
--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