rfc:closures:removal-of-this

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:closures:removal-of-this [2009/01/26 22:25]
cseiler added tidbits on reflection
rfc:closures:removal-of-this [2017/09/22 13:28] (current)
Line 1: Line 1:
 ====== Removal of $this in closures ====== ====== Removal of $this in closures ======
- 
-(NOTE THAT THIS IS NOT COMMITTED YET. THIS PAGE IS STILL WORK IN PROGRESS) 
  
 This document describes the changes that were done in order to remove $this support from closures for PHP 5.3 beta1. This has become necessary in order to make sure that when a consensus is found on how to add $this to closures, it will be able to integrate that without BC issues. This document describes the changes that were done in order to remove $this support from closures for PHP 5.3 beta1. This has become necessary in order to make sure that when a consensus is found on how to add $this to closures, it will be able to integrate that without BC issues.
Line 65: Line 63:
  
 Thus, a ''​new ReflectionFunction($closure)''​ has access to the real user-defined closure details and ''​new ReflectionMethod($closure,​ "​_invoke"​)''​ has access to the internal auto-generated handler method. Thus, a ''​new ReflectionFunction($closure)''​ has access to the real user-defined closure details and ''​new ReflectionMethod($closure,​ "​_invoke"​)''​ has access to the internal auto-generated handler method.
 +
 +''​new ReflectionMethod ($closure)''​ will not work anymore. This is for consistency reasons, since if both ReflectionMethod and ReflectionFunction constructors accepted the closure directly, it would not be clear what ''​new ReflectionParameter ($closure, 1)''​ would do (now it is clear: use ReflectionFunction as the constructor).
  
 ==== isClosure ==== ==== isClosure ====
rfc/closures/removal-of-this.txt · Last modified: 2017/09/22 13:28 (external edit)