closure_from_callable_rebinding.phpt 330 B

1234567891011121314151617181920
  1. --TEST--
  2. Testing Closure::fromCallable() functionality: Rebinding
  3. --FILE--
  4. <?php
  5. class A {
  6. public function method() {
  7. var_dump($this);
  8. }
  9. }
  10. class B {
  11. }
  12. $fn = Closure::fromCallable([new A, 'method']);
  13. $fn->call(new B);
  14. ?>
  15. --EXPECTF--
  16. Warning: Cannot bind method A::method() to object of class B in %s on line %d