com php-src: Closure binding and trait binding to anonymous class tests.: Zend/tests/anon/013.phpt Zend/tests/anon/014.phpt

From: Date: Sun, 18 Oct 2015 22:39:34 +0000
Subject: com php-src: Closure binding and trait binding to anonymous class tests.: Zend/tests/anon/013.phpt Zend/tests/anon/014.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89448@lists.php.net to get a copy of this message
Commit: 0a575fe7112334411be8d01de3b494ad1668e685 Author: Stanislav Malyshev <stas@php.net> Sun, 18 Oct 2015 15:39:34 -0700 Parents: 397f8696784097b1a8aef5b4f6e0080efafa37ab Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0a575fe7112334411be8d01de3b494ad1668e685 Log: Closure binding and trait binding to anonymous class tests. Changed paths: A Zend/tests/anon/013.phpt A Zend/tests/anon/014.phpt Diff: diff --git a/Zend/tests/anon/013.phpt b/Zend/tests/anon/013.phpt new file mode 100644 index 0000000..72ba3d6 --- /dev/null +++ b/Zend/tests/anon/013.phpt @@ -0,0 +1,15 @@ +--TEST-- +closure binding to anonymous class +--FILE-- +<?php +$class = new class {}; +$foo = function() { + return $this; +}; + +$closure = Closure::bind($foo, $class, $class); +var_dump($closure()); +?> +--EXPECTF-- +object(class@anonymous)#1 (0) { +} diff --git a/Zend/tests/anon/014.phpt b/Zend/tests/anon/014.phpt new file mode 100644 index 0000000..cacac47 --- /dev/null +++ b/Zend/tests/anon/014.phpt @@ -0,0 +1,16 @@ +--TEST-- +anonymous class trait binding +--FILE-- +<?php +trait TaskTrait { + function run() { + return 'Running...'; + } +} +$class = new class() { + use TaskTrait; +}; +var_dump($class->run()); +?> +--EXPECTF-- +string(10) "Running..."

« previous php.cvs (#89448) next »