Doc #78449 [NEW]: The definition of the parameter newscope is not clear.
| From: | dominic dot mayers at meditationstudies dot org | Date: | Fri, 23 Aug 2019 17:00:31 +0000 |
| Subject: | Doc #78449 [NEW]: The definition of the parameter newscope is not clear. | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-16897@lists.php.net to get a copy of this message | ||
From: dominic dot mayers at meditationstudies dot org
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:The definition of the parameter newscope is not clear.
Description:
------------
---
From manual page: https://php.net/closure.bind
---
Here is the description of the parameter newscope.
newscope: The class scope to which associate the closure is to be
associated, or 'static' to keep the current one. If an object is given,
the type of the object will be used instead. This determines the
visibility of protected and private methods of the bound object. It is
not allowed to pass (an object of) an internal class as this parameter.
First, though English is not my first language, the first sentence seems
to be bugged. Second, the third sentence might be misinterpreted as
describing the main purpose of the parameter. It's not, because the
closure does not even need to be bound. You even give an example of this
fact in the example
$bcl1 = Closure::bind($cl1, null, 'A');
Here is another interesting example:
$a = new A();
$bcl3 = Closure::bind(function () use($a) {return $a->ifoo;}, null,
'A');
The first sentence could simply say that the parameter is the class
scope of the new closure, or "static" to keep the current one. The third
sentence could be
"In particular, it affects whether the closure can access the
protected
and private methods of the bound object, if any."
The "In particular" makes clear that it is not the main thing that it
does. The "if any" makes clear that the bound object is not required.
--
Edit bug report at https://bugs.php.net/bug.php?id=78449&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78449&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78449&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78449&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78449&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78449&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78449&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78449&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78449&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78449&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78449&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78449&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78449&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78449&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78449&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78449&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78449&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78449&r=mysqlcfg