Merge branch 'release/0.8.9'
Автор
Justin Hileman

Коммитер
Justin Hileman
8 лет назад 
Файлов изменено: 4
+23–19
58a31cc
src/Psy/.../WhereamiCommand.php
+18–14
@@ -67,26 +67,30 @@ | ||
} | ||
/** | ||
* Obtains the correct trace in the full backtrace. | ||
* Obtains the correct stack frame in the full backtrace. | ||
* | ||
* @return array | ||
*/ | ||
protected function trace() | ||
{ | ||
foreach ($this->backtrace as $i => $backtrace) { | ||
if (!isset($backtrace['class'], $backtrace['function'])) { | ||
continue; | ||
} | ||
$correctClass = $backtrace['class'] === 'Psy\Shell'; | ||
$correctFunction = $backtrace['function'] === 'debug'; | ||
if ($correctClass && $correctFunction) { | ||
return $backtrace; | ||
foreach (array_reverse($this->backtrace) as $stackFrame) { | ||
if ($this->isDebugCall($stackFrame)) { | ||
return $stackFrame; | ||
} | ||
} | ||
return end($this->backtrace); | ||
} | ||
private static function isDebugCall(array $stackFrame) | ||
{ | ||
$class = isset($stackFrame['class']) ? $stackFrame['class'] : null; | ||
$function = isset($stackFrame['function']) ? $stackFrame['function'] : null; | ||
return ($class === null && $function === 'Psy\debug') || | ||
($class === 'Psy\Shell' && in_array($function, array('__construct', 'debug'))); | ||
} | ||
/** | ||
* Determine the file and line based on the specific backtrace. | ||
* | ||
@@ -94,14 +98,14 @@ | ||
*/ | ||
protected function fileInfo() | ||
{ | ||
$backtrace = $this->trace(); | ||
if (preg_match('/eval\(/', $backtrace['file'])) { | ||
preg_match_all('/([^\(]+)\((\d+)/', $backtrace['file'], $matches); | ||
$stackFrame = $this->trace(); | ||
if (preg_match('/eval\(/', $stackFrame['file'])) { | ||
preg_match_all('/([^\(]+)\((\d+)/', $stackFrame['file'], $matches); | ||
$file = $matches[1][0]; | ||
$line = (int) $matches[2][0]; | ||
} else { | ||
$file = $backtrace['file']; | ||
$line = $backtrace['line']; | ||
$file = $stackFrame['file']; | ||
$line = $stackFrame['line']; | ||
} | ||
return compact('file', 'line'); |
src/Psy/Configuration.php
+1–1
@@ -183,7 +183,7 @@ | ||
*/ | ||
public function getLocalConfigFile() | ||
{ | ||
$localConfig = getenv('PWD') . '/.psysh.php'; | ||
$localConfig = getcwd() . '/.psysh.php'; | ||
if (@is_file($localConfig)) { | ||
return $localConfig; |
src/Psy/Shell.php
+1–1
@@ -44,7 +44,7 @@ | ||
*/ | ||
class Shell extends Application | ||
{ | ||
const VERSION = 'v0.8.8'; | ||
const VERSION = 'v0.8.9'; | ||
const PROMPT = '>>> '; | ||
const BUFF_PROMPT = '... '; |
test/Psy/.../ConfigurationTest.php
+3–3
@@ -142,8 +142,8 @@ | ||
public function testLoadLocalConfigFile() | ||
{ | ||
$oldPwd = getenv('PWD'); | ||
putenv('PWD=' . realpath(__DIR__ . '/../../fixtures/project/')); | ||
$oldPwd = getcwd(); | ||
chdir(realpath(__DIR__ . '/../../fixtures/project/')); | ||
$config = new Configuration(); | ||
@@ -157,7 +157,7 @@ | ||
$this->assertTrue($config->useReadline()); | ||
$this->assertFalse($config->usePcntl()); | ||
putenv("PWD=$oldPwd"); | ||
chdir($oldPwd); | ||
} | ||
/** |
Cherry-pick
Команда cherry-pick позволяет выбрать отдельные коммиты из одной ветки и применить их к другой.