1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Make --init use vendor-dir from composer.json (#2313)

This commit is contained in:
Joram Schrijver 2019-11-08 12:59:04 +01:00 committed by Matthew Brown
parent 5217156068
commit e79a0cc8f0
2 changed files with 11 additions and 2 deletions

View File

@ -25,7 +25,8 @@ class Creator
public static function getContents(
string $current_dir,
string $suggested_dir = null,
int $level = 3
int $level = 3,
string $vendor_dir = 'vendor'
) : string {
$replacements = [];
@ -82,6 +83,12 @@ class Creator
$template
);
$template = str_replace(
'<directory name="vendor" />',
'<directory name="' . $vendor_dir . '" />',
$template
);
return $template;
}

View File

@ -247,8 +247,10 @@ if (isset($options['i'])) {
$source_dir = $args[0];
}
$vendor_dir = getVendorDir($current_dir);
try {
$template_contents = Psalm\Config\Creator::getContents($current_dir, $source_dir, $level);
$template_contents = Psalm\Config\Creator::getContents($current_dir, $source_dir, $level, $vendor_dir);
} catch (Psalm\Exception\ConfigCreationException $e) {
die($e->getMessage() . PHP_EOL);
}