merge from yiisoft/yii2

This commit is contained in:
cuileon
2018-11-14 11:57:32 +08:00
parent 47df8a8cc0
commit 489dd119a5
426 changed files with 18465 additions and 4215 deletions

View File

@ -116,13 +116,13 @@ class HelpController extends Controller
}
foreach ($controller->getActionArgsHelp($action) as $argument => $help) {
$description = str_replace("\n", '', addcslashes($help['comment'], ':')) ?: $argument;
$description = preg_replace("~\R~", '', addcslashes($help['comment'], ':')) ?: $argument;
$this->stdout($argument . ':' . $description . "\n");
}
$this->stdout("\n");
foreach ($controller->getActionOptionsHelp($action) as $argument => $help) {
$description = str_replace("\n", '', addcslashes($help['comment'], ':'));
$description = preg_replace("~\R~", '', addcslashes($help['comment'], ':'));
$this->stdout('--' . $argument . ($description ? ':' . $description : '') . "\n");
}
}
@ -251,16 +251,16 @@ class HelpController extends Controller
$file = $matches[0];
$relativePath = str_replace($controllerPath, '', $file);
$class = strtr($relativePath, [
DIRECTORY_SEPARATOR => '\\',
'/' => '\\',
'.php' => '',
]);
$controllerClass = $module->controllerNamespace . $class;
if ($this->validateControllerClass($controllerClass)) {
$dir = ltrim(pathinfo($relativePath, PATHINFO_DIRNAME), DIRECTORY_SEPARATOR);
$dir = ltrim(pathinfo($relativePath, PATHINFO_DIRNAME), '\\/');
$command = Inflector::camel2id(substr(basename($file), 0, -14), '-', true);
if (!empty($dir)) {
$command = $dir . DIRECTORY_SEPARATOR . $command;
$command = $dir . '/' . $command;
}
$commands[] = $prefix . $command;
}