Doc #78448 [Csd->Spm]: The definition of the parameter newscope is not clear.
| From: | requinix@php.net | Date: | Fri, 23 Aug 2019 17:01:04 +0000 |
| Subject: | Doc #78448 [Csd->Spm]: The definition of the parameter newscope is not clear. | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16898@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78448&edit=1
ID: 78448
Updated by: requinix@php.net
Reported by: dominic dot mayers at meditationstudies dot org
Summary: The definition of the parameter newscope is not
clear.
-Status: Closed
+Status: Spam
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
-Assigned To: requinix
+Assigned To:
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2019-08-23 16:55:29] requinix@php.net
A third one? You want to open a third one?
This one is fine. Let it be. If you want to add something more then a comment is fine.
------------------------------------------------------------------------
[2019-08-23 16:53:32] dominic dot mayers at meditationstudies dot org
Since I don't see any way to edit the description and there is no activity on this bug and I am
pretty sure it will take some time before it is looked at, I am closing it and opening a new one.
The edit is that I meant the third sentence, not the second sentence.
------------------------------------------------------------------------
[2019-08-23 08:21:31] dominic dot mayers at meditationstudies dot org
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
second 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 it is the class scope of the new closure, I think. The
second 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 this bug report at https://bugs.php.net/bug.php?id=78448&edit=1