Doc #73259 [PATCH]: Documentation for interfaces doesn't mention LSP
| From: | girgias@php.net | Date: | Sun, 20 Jan 2019 17:56:54 +0000 |
| Subject: | Doc #73259 [PATCH]: Documentation for interfaces doesn't mention LSP | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16353@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73259&edit=1
ID: 73259
Patch added by: girgias@php.net
Reported by: phansys at gmail dot com
Summary: Documentation for interfaces doesn't mention LSP
Status: Assigned
Type: Documentation Problem
Package: Class/Object related
Operating System: any
PHP Version: Irrelevant
Assigned To: girgias
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2016-10-06 15:30:05] 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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73259&edit=1