On ReflectionParameter::canBePassedByValue()

From: Date: Tue, 26 Oct 2010 19:04:39 +0000
Subject: On ReflectionParameter::canBePassedByValue()
Groups: php.internals 
Request: Send a blank email to internals+get-49977@lists.php.net to get a copy of this message
Hi. As you may or may not know, the "zend_bool" arg_info->pass_by_reference, may take three values:
785 #define ZEND_SEND_BY_VAL     0
786 #define ZEND_SEND_BY_REF     1
787 #define ZEND_SEND_PREFER_REF 2 The last one is used one the function can either take a value or reference; see e.g. array_multisort. ReflectionParameter has only only method, with an actual boolean return to test this, isPassedByReference(). This returns true for ZEND_SEND_BY_REF or ZEND_SEND_PREFER_REF, so there's no way to distinguish between the two. To solve this, I added to trunk ReflectionParameter::canBePassedByValue(), which tests for ZEND_SEND_BY_VAL or ZEND_SEND_PREFER_REF. Concerns have been raised over the naming of the method and over whether having three methods for three values would be more appropriate (with a minor BC break, changing the behavior of isPassedByReference() to return true only with ZEND_SEND_BY_REF). Any comments on this issue are appreciated. Thanks -- Gustavo Lopes

« previous php.internals (#49977) next »