note 129057 added to closure.bindto
| From: | malferov at gmail dot com | Date: | Mon, 20 Nov 2023 19:09:40 +0000 |
| Subject: | note 129057 added to closure.bindto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221011@lists.php.net to get a copy of this message | ||
If you, like me, did not immediately understand what exactly "(an object of) an internal
class" in the documentation about the 'newScope' parameter:
The documentation is about the object of the Closure itself:
<?php
class A {}
$a = new A();
$closure = fn() => null;
$binded = $closure->bindTo($a, $closure,); // Warning: Cannot bind closure to scope of internal
class Closure
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 95.25.88.107)
----
Manual Page -- https://php.net/manual/en/closure.bindto.php
Edit -- https://main.php.net/note/edit/129057
Del: integrated -- https://main.php.net/note/delete/129057/integrated
Del: useless -- https://main.php.net/note/delete/129057/useless
Del: bad code -- https://main.php.net/note/delete/129057/bad+code
Del: spam -- https://main.php.net/note/delete/129057/spam
Del: non-english -- https://main.php.net/note/delete/129057/non-english
Del: in docs -- https://main.php.net/note/delete/129057/in+docs
Del: other reasons-- https://main.php.net/note/delete/129057
Reject -- https://main.php.net/note/reject/129057
Search -- https://main.php.net/manage/user-notes.php