Document parent::/self:: forwarding in LSB

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@263743 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Etienne Kneuss 2008-07-29 00:29:44 +00:00
parent 08d4cbcee2
commit 3a14ef1767

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<sect1 xml:id="language.oop5.late-static-bindings" xmlns="http://docbook.org/ns/docbook">
<title>Late Static Bindings</title>
<para>
@ -153,10 +153,10 @@ TestParent
</example>
<note>
<para>
Late static bindings' resolution will stop at a fully resolved static call with no fallback.
Late static bindings' resolution will stop at a fully resolved static call with no fallback. On the other hand, static calls using keywords like <literal>parent::</literal> or <literal>self::</literal> will forward the calling information.
</para>
<example>
<title>Fully resolved static calls</title>
<title>Forwarding and non-forwarding calls</title>
<programlisting role="php">
<![CDATA[
<?php
@ -173,14 +173,21 @@ class A {
class B extends A {
public static function test() {
A::foo();
parent::foo();
self::foo();
}
public static function who() {
echo __CLASS__."\n";
}
}
class C extends B {
public static function who() {
echo __CLASS__."\n";
}
}
B::test();
C::test();
?>
]]>
</programlisting>
@ -188,6 +195,8 @@ B::test();
<screen>
<![CDATA[
A
C
C
]]>
</screen>
</example>