Do You PHP はてブロ

Do You PHPはてなからはてブロに移動しました

Closureクラスはfinalクラスらしい

まあ、何となく。。。

$ php -v
PHP 5.3.0-dev (cli) (built: Jul 15 2008 17:36:47)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies
$ cat closure.php
<?php
$lambda = function () {};
$class= new ReflectionClass($lambda);
echo $class;
$ php closure.php
Class [ <internal> final class Closure ] {

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [1] {
    Method [ <internal> public method __invoke ] {
    }
  }
}
$ 

ほうほう。
ついでに。。。

$ cat instanciate.php
<?php
$lambda = new Closure();
var_dump($lambda);
$ php instanciate.php
PHP Fatal error:  Instantiation of 'Closure' is not allowed in /path/to/instanciate.php on line 2
$ 

あ。やっぱり?