Doc #65241 [Opn->Csd]: ReflectionProperty::getValue(void) is not a valid documentation

From: Date: Fri, 04 Oct 2013 17:07:56 +0000
Subject: Doc #65241 [Opn->Csd]: ReflectionProperty::getValue(void) is not a valid documentation
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10411@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65241&edit=1

 ID:                 65241
 Updated by:         krakjoe@php.net
 Reported by:        toycat at toycat dot eu
 Summary:            ReflectionProperty::getValue(void) is not a valid
                     documentation
-Status:             Open
+Status:             Closed
 Type:               Documentation Problem
 Package:            Documentation problem
 Operating System:   MacOS X 10.8.4
 PHP Version:        5.4.17
-Assigned To:        
+Assigned To:        krakjoe
 Block user comment: N
 Private report:     N

 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.




Previous Comments:
------------------------------------------------------------------------
[2013-10-04 17:07:52] krakjoe@php.net

Automatic comment from SVN on behalf of krakjoe
Revision: http://svn.php.net/viewvc/?view=revision&revision=331666
Log: #65241 correction to params in manual

------------------------------------------------------------------------
[2013-08-02 05:55:52] logan at logansbailey dot com

The definition of the parameter states:

If the property is non-static an object must be provided to fetch the property from. If you want to
fetch the default property without providing an object use ReflectionClass::getDefaultProperties()
instead. 

I believe that this functionality is accurately documented.

<?php
class MyClass {

    public $foo = 'test';
    public static $bar = 'test';

}

// Errors out
$fooReflector = new ReflectionProperty('MyClass', 'foo');
var_dump($fooReflector->getValue());

// Works
$staticReflector = new ReflectionProperty('MyClass', 'bar');
var_dump($staticReflector->getValue());

// Works because an instance of the object is passed in
var_dump($fooReflector->getValue(new MyClass()));

// Returns array('bar' => 'test', 'foo' => 'test')
$classReflector = new ReflectionClass('MyClass');
var_dump($classReflector->getDefaultProperties());

------------------------------------------------------------------------
[2013-07-11 09:01:50] toycat at toycat dot eu

Description:
------------
The following is not a valid documentation (or there is a PHP bug):

public mixed ReflectionProperty::getValue ( void )

---
From manual page: http://www.php.net/reflectionproperty.getvalue#refsect1-
reflectionproperty.getvalue-description
---


Test script:
---------------
<?php
class MyClass {

    public $property = 'test';

}

$object = new MyClass();
$reflector = new \ReflectionObject($object);
var_dump($reflector->getProperty('property')->getValue());


Expected result:
----------------
Outputs:

string(4) "test"

Actual result:
--------------
Outputs:

<br />
<b>Warning</b>:  ReflectionProperty::getValue() expects exactly 1 parameter, 0 
given in <b>__FILE__</b> on line <b>10</b><br />
NULL



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65241&edit=1


Thread (3 messages)

« previous php.doc.bugs (#10411) next »