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:
Daniel Egeberg 2010-02-24 12:44:37 +00:00
parent 80cbff1fc0
commit a3371d8b3e
2 changed files with 12 additions and 0 deletions

View file

@ -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">

View file

@ -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">