blob: a5f52e70b00f8272c8c424f7afe963de7bb35bbe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
--TEST--
Closure 040: Rebinding closures, bad arguments
--FILE--
<?php
class A {
private $x;
private static $xs = 10;
public function __construct($v) {
$this->x = $v;
}
public function getIncrementor() {
return function() { return ++$this->x; };
}
public function getStaticIncrementor() {
return static function() { return ++static::$xs; };
}
}
$a = new A(20);
$ca = $a->getIncrementor();
$cas = $a->getStaticIncrementor();
$ca->bindTo($a, array());
$cas->bindTo($a, 'A');
?>
--EXPECTF--
Warning: Array to string conversion in %s on line %d
Warning: Class 'Array' not found in %s on line %d
Warning: Cannot bind an instance to a static closure in %s on line %d
|