svn: /phpdoc/en/trunk/reference/reflection/reflectionparameter/ getdeclaringclass.xml

From: Date: Tue, 23 Jun 2015 14:25:06 +0000
Subject: svn: /phpdoc/en/trunk/reference/reflection/reflectionparameter/ getdeclaringclass.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-13425@lists.php.net to get a copy of this message
googleguy Tue, 23 Jun 2015 14:25:06 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=337035 Log: Add some sensible example for ReflectionParameter::getDeclaringClass() Changed paths: U phpdoc/en/trunk/reference/reflection/reflectionparameter/getdeclaringclass.xml Modified: phpdoc/en/trunk/reference/reflection/reflectionparameter/getdeclaringclass.xml =================================================================== --- phpdoc/en/trunk/reference/reflection/reflectionparameter/getdeclaringclass.xml 2015-06-23 12:51:25 UTC (rev 337034) +++ phpdoc/en/trunk/reference/reflection/reflectionparameter/getdeclaringclass.xml 2015-06-23 14:25:06 UTC (rev 337035) @@ -33,6 +33,43 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Getting the class that declared the method</title> + <programlisting role="php"> +<![CDATA[ +<?php +class Foo +{ + public function bar(\DateTime $datetime) + { + } +} + +class Baz extends Foo +{ +} + +$param = new \ReflectionParameter(['Baz', 'bar'], 0); + +var_dump($param->getDeclaringClass()); +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +object(ReflectionClass)#2 (1) { + ["name"]=> + string(3) "Foo" +} +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para>

« previous php.doc.cvs (#13425) next »