cvs: phpdoc-de /language/oop5 typehinting.xml
| From: | Hartmut Holzgraefe | Date: | Wed, 24 Sep 2008 21:52:28 +0000 |
| Subject: | cvs: phpdoc-de /language/oop5 typehinting.xml | ||
| Groups: | php.doc.de | ||
| Request: | Send a blank email to doc-de+get-2813@lists.php.net to get a copy of this message | ||
hholzgra Wed Sep 24 21:52:28 2008 UTC
Modified files:
/phpdoc-de/language/oop5 typehinting.xml
Log:
translation update
http://cvs.php.net/viewvc.cgi/phpdoc-de/language/oop5/typehinting.xml?r1=1.4&r2=1.5&diff_format=u
Index: phpdoc-de/language/oop5/typehinting.xml
diff -u phpdoc-de/language/oop5/typehinting.xml:1.4 phpdoc-de/language/oop5/typehinting.xml:1.5
--- phpdoc-de/language/oop5/typehinting.xml:1.4 Wed Jun 18 00:07:12 2008
+++ phpdoc-de/language/oop5/typehinting.xml Wed Sep 24 21:52:28 2008
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
-<!-- EN-Revision: 1.5 Maintainer: nobody Status: ready -->
+<!-- $Revision: 1.5 $ -->
+<!-- EN-Revision: 1.6 Maintainer: hholzgra Status: ready -->
<sect1 xml:id="language.oop5.typehinting" xmlns="http://docbook.org/ns/docbook">
<title>Type Hinting</title>
<para>
PHP 5 führt Type Hinting ein. Funktionen sind damit fähig, Parameter zu
zwingen, Objekte (indem man den Namen der Klasse im Funktionsprototyp
- spezifiziert) oder Arrays (seit PHP 5.1) zu sein.
+ spezifiziert) oder Arrays (seit PHP 5.1) zu sein. Wird dabei <type>NULL</type>
+ als Vorgabewert für einen Parameter angegeben so ist dies ein weiterer
+ gültiger Aufrufwert neben dem spezifizierten Typ.
</para>
<example>
@@ -101,6 +103,24 @@
?>
]]>
</programlisting>
+ <para>
+ Type hinting mit möglichen NULL Werten:
+ </para>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+/* Akzeptiert NULL Werte */
+function test(stdClass $obj = NULL) {
+
+}
+
+test(NULL);
+test(new stdClass);
+
+?>
+]]>
+ </programlisting>
</example>
<para>
Type Hints können nur vom Typen <type>object</type> und (seit PHP 5.1)