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
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: 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-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 17:01:34 2025 UTC