mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Fixed PHP bug #50870 (Constructor parameters do not have to match those of superclass constructor)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@295468 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
80cbff1fc0
commit
a3371d8b3e
2 changed files with 12 additions and 0 deletions
|
@ -196,6 +196,12 @@ object(SimpleClass)#1 (1) {
|
|||
methods or static properties by referencing them
|
||||
with <link linkend="language.oop5.paamayim-nekudotayim">parent::</link>.
|
||||
</para>
|
||||
<para>
|
||||
When overriding methods, the parameter signature should remain the same or
|
||||
PHP will generate an <constant>E_STRICT</constant> level error. This does
|
||||
not apply to the constructor, which allows overriding with different
|
||||
parameters.
|
||||
</para>
|
||||
<example>
|
||||
<title>Simple Class Inheritance</title>
|
||||
<programlisting role="php">
|
||||
|
|
|
@ -56,6 +56,12 @@ $obj = new SubClass();
|
|||
issues is if the class had a method named
|
||||
<function>__construct</function> which was used for different semantics.
|
||||
</para>
|
||||
<para>
|
||||
Unlike with other metods, PHP will not generate an
|
||||
<constant>E_STRICT</constant> level error message when
|
||||
<function>__construct</function> is overridden with different parameters
|
||||
than the parent <function>__construct</function> method has.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 xml:id="language.oop5.decon.destructor">
|
||||
|
|
Loading…
Reference in a new issue