rfc:useas

This is an old revision of the document!


Request for Comments: Allow use T_AS in closure use statement

Introduction

Allow use AS in the closure declaration, like:

<?php
  $foo = "bar";
  
  $func = function () ues ($foo as $dup, &$foo as $ref) { //alias name
  };
  

Proposal

I have made a patch, but for now, it doesn't support alias $this, like:

<?php

class Foo {
   public function bar() {
      return function() use ($this as $obj) //Error
      {};
   }
}

but I will be keeping to improve it.

Patch

Changelog

  • 2012-04-12 Xinchen Hui Initial version
rfc/useas.1334242971.txt.gz · Last modified: 2017/09/22 13:28 (external edit)