Mercurial > hg > isophonics-drupal-site
diff vendor/psy/psysh/src/functions.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 5fb285c0d0e3 |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/vendor/psy/psysh/src/functions.php Thu Apr 26 11:26:54 2018 +0100 +++ b/vendor/psy/psysh/src/functions.php Tue Jul 10 15:07:59 2018 +0100 @@ -28,7 +28,7 @@ */ function sh() { - return 'extract(\Psy\debug(get_defined_vars(), isset($this) ? $this : null));'; + return 'extract(\Psy\debug(get_defined_vars(), isset($this) ? $this : @get_called_class()));'; } } @@ -50,9 +50,9 @@ * var_dump($item); // will be whatever you set $item to in Psy Shell * } * - * Optionally, supply an object as the `$boundObject` parameter. This - * determines the value `$this` will have in the shell, and sets up class - * scope so that private and protected members are accessible: + * Optionally, supply an object as the `$bindTo` parameter. This determines + * the value `$this` will have in the shell, and sets up class scope so that + * private and protected members are accessible: * * class Foo { * function bar() { @@ -60,12 +60,22 @@ * } * } * - * @param array $vars Scope variables from the calling context (default: array()) - * @param object $boundObject Bound object ($this) value for the shell + * For the static equivalent, pass a class name as the `$bindTo` parameter. + * This makes `self` work in the shell, and sets up static scope so that + * private and protected static members are accessible: + * + * class Foo { + * static function bar() { + * \Psy\debug(get_defined_vars(), get_called_class()); + * } + * } + * + * @param array $vars Scope variables from the calling context (default: array()) + * @param object|string $bindTo Bound object ($this) or class (self) value for the shell * * @return array Scope variables from the debugger session */ - function debug(array $vars = [], $boundObject = null) + function debug(array $vars = [], $bindTo = null) { echo PHP_EOL; @@ -79,8 +89,10 @@ $sh->addInput('whereami -n2', true); } - if ($boundObject !== null) { - $sh->setBoundObject($boundObject); + if (is_string($bindTo)) { + $sh->setBoundClass($bindTo); + } elseif ($bindTo !== null) { + $sh->setBoundObject($bindTo); } $sh->run();