2018-01-07 06:11:23 +01:00
|
|
|
<?php
|
|
|
|
|
2020-07-22 21:57:24 +02:00
|
|
|
namespace Psalm;
|
|
|
|
|
2019-07-07 14:55:53 +02:00
|
|
|
use Composer\Autoload\ClassLoader;
|
2021-06-01 04:23:54 +02:00
|
|
|
use Psalm\Internal\CliUtils;
|
2019-07-07 14:55:53 +02:00
|
|
|
|
2021-06-01 04:23:54 +02:00
|
|
|
// phpcs:disable PSR1.Files.SideEffects
|
|
|
|
require_once __DIR__ . '/Psalm/Internal/CliUtils.php';
|
|
|
|
|
|
|
|
/** @deprecated going to be removed in Psalm 5 */
|
2020-09-07 01:36:47 +02:00
|
|
|
function requireAutoloaders(string $current_dir, bool $has_explicit_root, string $vendor_dir): ?ClassLoader
|
2018-01-07 06:11:23 +01:00
|
|
|
{
|
2021-06-01 04:23:54 +02:00
|
|
|
return CliUtils::requireAutoloaders($current_dir, $has_explicit_root, $vendor_dir);
|
2018-01-07 06:11:23 +01:00
|
|
|
}
|
|
|
|
|
2021-06-01 04:23:54 +02:00
|
|
|
/** @deprecated going to be removed in Psalm 5 */
|
2020-09-07 01:36:47 +02:00
|
|
|
function getVendorDir(string $current_dir): string
|
2018-01-25 17:32:54 +01:00
|
|
|
{
|
2021-06-01 04:23:54 +02:00
|
|
|
return CliUtils::getVendorDir($current_dir);
|
2018-01-25 17:32:54 +01:00
|
|
|
}
|
|
|
|
|
2019-06-02 07:10:50 +02:00
|
|
|
/**
|
2020-10-17 18:36:44 +02:00
|
|
|
* @return list<string>
|
2021-06-01 04:23:54 +02:00
|
|
|
* @deprecated going to be removed in Psalm 5
|
2019-06-02 07:10:50 +02:00
|
|
|
*/
|
2021-12-05 18:51:26 +01:00
|
|
|
function getArguments(): array
|
2019-06-02 07:10:50 +02:00
|
|
|
{
|
2021-06-01 04:23:54 +02:00
|
|
|
return CliUtils::getArguments();
|
2019-06-02 07:10:50 +02:00
|
|
|
}
|
|
|
|
|
2018-01-25 17:32:54 +01:00
|
|
|
/**
|
|
|
|
* @param string|array|null|false $f_paths
|
2018-01-07 06:11:23 +01:00
|
|
|
*
|
2020-10-17 18:36:44 +02:00
|
|
|
* @return list<string>|null
|
2021-06-01 04:23:54 +02:00
|
|
|
* @deprecated going to be removed in Psalm 5
|
2018-01-07 06:11:23 +01:00
|
|
|
*/
|
2020-09-04 22:26:33 +02:00
|
|
|
function getPathsToCheck($f_paths): ?array
|
2018-01-07 06:11:23 +01:00
|
|
|
{
|
2021-06-01 04:23:54 +02:00
|
|
|
return CliUtils::getPathsToCheck($f_paths);
|
2018-01-07 06:11:23 +01:00
|
|
|
}
|
2019-07-07 14:55:53 +02:00
|
|
|
|
2020-08-23 19:52:31 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2021-06-01 04:23:54 +02:00
|
|
|
* @deprecated going to be removed in Psalm 5
|
2020-08-23 19:52:31 +02:00
|
|
|
*/
|
2019-07-07 14:55:53 +02:00
|
|
|
function getPsalmHelpText(): string
|
|
|
|
{
|
2021-06-01 04:23:54 +02:00
|
|
|
return CliUtils::getPsalmHelpText();
|
2019-07-07 14:55:53 +02:00
|
|
|
}
|
|
|
|
|
2021-06-01 04:23:54 +02:00
|
|
|
/** @deprecated going to be removed in Psalm 5 */
|
2019-07-07 14:55:53 +02:00
|
|
|
function initialiseConfig(
|
|
|
|
?string $path_to_config,
|
|
|
|
string $current_dir,
|
|
|
|
string $output_format,
|
2020-11-21 01:02:44 +01:00
|
|
|
?ClassLoader $first_autoloader,
|
|
|
|
bool $create_if_non_existent = false
|
2019-07-07 14:55:53 +02:00
|
|
|
): Config {
|
2021-06-01 04:23:54 +02:00
|
|
|
return CliUtils::initializeConfig(
|
|
|
|
$path_to_config,
|
|
|
|
$current_dir,
|
|
|
|
$output_format,
|
|
|
|
$first_autoloader,
|
|
|
|
$create_if_non_existent
|
|
|
|
);
|
2019-07-07 14:55:53 +02:00
|
|
|
}
|
|
|
|
|
2021-06-01 04:23:54 +02:00
|
|
|
/** @deprecated going to be removed in Psalm 5 */
|
2021-12-05 18:51:26 +01:00
|
|
|
function update_config_file(Config $config, string $config_file_path, string $baseline_path): void
|
2019-09-09 23:03:23 +02:00
|
|
|
{
|
2021-06-01 04:23:54 +02:00
|
|
|
CliUtils::updateConfigFile($config, $config_file_path, $baseline_path);
|
2019-09-09 23:03:23 +02:00
|
|
|
}
|
|
|
|
|
2021-06-01 04:23:54 +02:00
|
|
|
/** @deprecated going to be removed in Psalm 5 */
|
2019-07-07 14:55:53 +02:00
|
|
|
function get_path_to_config(array $options): ?string
|
|
|
|
{
|
2021-06-01 04:23:54 +02:00
|
|
|
return CliUtils::getPathToConfig($options);
|
2019-07-07 14:55:53 +02:00
|
|
|
}
|
2020-02-24 22:18:46 +01:00
|
|
|
|
2020-08-23 19:52:31 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2021-06-01 04:23:54 +02:00
|
|
|
* @deprecated going to be removed in Psalm 5
|
2020-08-23 19:52:31 +02:00
|
|
|
*/
|
2020-02-24 22:18:46 +01:00
|
|
|
function getMemoryLimitInBytes(): int
|
|
|
|
{
|
2021-06-01 04:23:54 +02:00
|
|
|
return CliUtils::getMemoryLimitInBytes();
|
2020-02-24 22:18:46 +01:00
|
|
|
}
|