Advertisement
Danack

AurynCallable

Sep 19th, 2014
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. class foo {
  2.     private $random = 4;
  3.  
  4.     function getCallable() {
  5.         $callable = function () {
  6.             echo $this->random;
  7.         };
  8.  
  9.         return $callable;
  10.     }
  11. }
  12.  
  13.  
  14. $foo = new foo();
  15. $callable = $foo->getCallable();
  16. $callable(); //works fine.
  17.  
  18. $provider = new Auryn\Provider();
  19. $provider->execute($callable, []);
  20. //Fatal error: Using $this when not in object context in /documents/projects/github/Console/example.php on line 114
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement