rfc:useas

This is an old revision of the document!


Request for Comments: Allow use T_AS in closure use statement

  • Version: 1.0
  • Date: 2012/04/12
  • Author: Xinchen Hui <laruence@php.net)
  • Status: Under Discussion
  • First Published at: http://wiki.php.net/rfc/useas

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
    {};
 }

} ''

Patch

Changelog

  • 2012-04-12 Xinchen Hui Initial version
rfc/useas.1334242765.txt.gz · Last modified: (external edit)