php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #73259 Documentation for interfaces doesn't mention LSP
Submitted: 2016-10-06 15:30 UTC Modified: 2019-02-10 23:45 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: phansys at gmail dot com Assigned: girgias (profile)
Status: Closed Package: Class/Object related
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: phansys at gmail dot com
New email:
PHP Version: OS:

 

 [2016-10-06 15:30 UTC] phansys at gmail dot com
Description:
------------
http://php.net/manual/en/language.oop5.interfaces.php#language.oop5.interfaces states in a note:

"The class implementing the interface must use the exact same method signatures as are defined in the interface. Not doing so will result in a fatal error."

Which doesn't seem to mention LS principle in any way. For more information, check https://bugs.php.net/bug.php?id=73220.

Test script:
---------------
interface A
{
    public function test($one = null);
}

class B implements A
{
    public function test($one = null, $two = null)
    {
        var_dump($one, $two);
    }
}


Expected result:
----------------
Fatal error: Declaration of B::test($one, $two) must be compatible with A::test($one = NULL)


Actual result:
--------------
No error.


Patches

doc-fix-73259 (last revision 2019-01-20 17:56 UTC by girgias@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-06 16:10 UTC] requinix@php.net
-Package: Documentation problem +Package: Class/Object related
 [2019-01-11 02:47 UTC] girgias@php.net
-Assigned To: +Assigned To: girgias
 [2019-01-20 17:56 UTC] girgias@php.net
The following patch has been added/updated:

Patch Name: doc-fix-73259
Revision:   1548007014
URL:        https://bugs.php.net/patch-display.php?bug=73259&patch=doc-fix-73259&revision=1548007014
 [2019-02-10 23:45 UTC] pasindu@php.net
-Status: Assigned +Status: Closed
 [2019-02-10 23:45 UTC] pasindu@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

http://svn.php.net/viewvc?view=revision&revision=346783
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC