nlopess Fri Aug 6 06:43:52 2004 EDT
Modified files:
/phpdoc/en/language/oop5 reflection.xml
Log:
document ReflectionParameter::isOptional()
http://cvs.php.net/diff.php/phpdoc/en/language/oop5/reflection.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc/en/language/oop5/reflection.xml
diff -u phpdoc/en/language/oop5/reflection.xml:1.1
phpdoc/en/language/oop5/reflection.xml:1.2
--- phpdoc/en/language/oop5/reflection.xml:1.1 Sun Jul 11 08:33:25 2004
+++ phpdoc/en/language/oop5/reflection.xml Fri Aug 6 06:43:52 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<sect1 id="language.oop5.reflection">
<title>Reflection</title>
<sect2 id="language.oop5.reflection.introduction">
@@ -221,11 +221,17 @@
public ReflectionClass getClass()
public bool allowsNull()
public bool isPassedByReference()
+ public bool isOptional()
}
?>
]]>
</programlisting>
</informalexample>
+ <note>
+ <para>
+ <function>isOptional</function> was added in PHP 5.1.0.
+ </para>
+ </note>
<para>
To introspect function parameters, you will first have to create an instance
of the <classname>ReflectionFunction</classname> or
@@ -239,7 +245,7 @@
<?php
function foo($a, $b, $c) { }
function bar(Exception $a, &$b, $c) { }
- function baz($a = 1, $b = NULL, ReflectionFunction $c) { }
+ function baz(ReflectionFunction $a, $b = 1, $c = null) { }
function abc() { }
// Create an instance of Reflection_Function with the
@@ -255,12 +261,14 @@
" Class: %s\n".
" Allows NULL: %s\n".
" Passed to by reference: %s\n".
+ " Is optional?: %s\n".
"}\n",
$i,
$param->getName(),
var_export($param->getClass(), 1),
var_export($param->allowsNull(), 1),
- var_export($param->isPassedByReference(), 1)
+ var_export($param->isPassedByReference(), 1),
+ $param->isOptional() ? 'yes' : 'no'
);
}
?>