summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/rfc004.phpt
blob: 654fb9232175af1d4a1bedc1bf2a0d20a4c7d664 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--TEST--
RFC example: missing return type on override

--FILE--
<?php

class User {}

interface UserGateway {
    function find($id) : User;
}

class UserGateway_MySql implements UserGateway {
    // must return User or subtype of User
    function find($id) {
        return new User;
    }
}

--EXPECTF--
Fatal error: Declaration of UserGateway_MySql::find($id) must be compatible with UserGateway::find($id): User in %s on line 9