Doc #76049 [Opn]: ReflectionParameter::__construct() accepts an array for $function

From: Date: Mon, 05 Mar 2018 11:27:41 +0000
Subject: Doc #76049 [Opn]: ReflectionParameter::__construct() accepts an array for $function
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15490@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76049&edit=1 ID: 76049 Updated by: requinix@php.net Reported by: benjamin dot morel at gmail dot com Summary: ReflectionParameter::__construct() accepts an array for $function Status: Open Type: Documentation Problem -Package: Documentation problem +Package: Reflection related Operating System: N/A PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Valid strings and arrays, \Closures, and objects with __invoke are supported. "callable" would be the most appropriate type. Previous Comments: ------------------------------------------------------------------------ [2018-03-05 11:12:47] benjamin dot morel at gmail dot com Description: ------------ The ReflectionParameter constructor is documented as accepting a string only for the first parameter: http://php.net/manual/en/reflectionparameter.construct.php However, as mentioned in a comment on that page, it also accepts an array containing a class name and a method name. Test script: --------------- class Foo { function bar($baz) {} } $r = new ReflectionParameter(array('Foo', 'bar'), 'baz'); echo $r->getName(); Expected result: ---------------- public ReflectionParameter::__construct ( string|array $function , string $parameter ) Actual result: -------------- public ReflectionParameter::__construct ( string $function , string $parameter ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76049&edit=1

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