php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76000 Unable to annotate more specific return types in PHP 7.1
Submitted: 2018-02-23 17:05 UTC Modified: 2018-02-23 17:22 UTC
From: bexomixog at 69postix dot info Assigned: cmb (profile)
Status: Duplicate Package: *General Issues
PHP Version: 7.1.14 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bexomixog at 69postix dot info
New email:
PHP Version: OS:

 

 [2018-02-23 17:05 UTC] bexomixog at 69postix dot info
Description:
------------
Good evening. I think the following code should be allowed.

Test script:
---------------
<?php

class ParentClass
{
    
}

class ChildClass extends ParentClass
{
    
}

class A
{
    public function test() : ParentClass{}    
}

class B extends A
{
    public function test() : ChildClass{}    
}

Expected result:
----------------
No error.

Actual result:
--------------
Fatal error: Declaration of B::test(): ChildClass must be compatible with A::test(): ParentClass

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-23 17:15 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2018-02-23 17:15 UTC] cmb@php.net
Duplicate of feature request #72442.
 [2018-02-23 17:22 UTC] cmb@php.net
-Status: Closed +Status: Duplicate
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 04:01:28 2024 UTC