Doc #78447 [NEW]: The definition of the parameter newscope is not clear.
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, speaking of a bound object is misleading, because
newscope is still meaningful when the closure is not 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');
I would add this third case in the example. It is used in the getLoader
method in Composer. So, this reliable use of Closure::bind should be
documented.
--
Edit bug report at https://bugs.php.net/bug.php?id=78447&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78447&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78447&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78447&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78447&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78447&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78447&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78447&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78447&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78447&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78447&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78447&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78447&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78447&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78447&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78447&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78447&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78447&r=mysqlcfg
Thread (4 messages)
- dominic dot mayers at meditationstudies dot org