setConfigXML($path_to_config, $current_dir); } $config = $project_checker->getConfig(); if (!$config) { $project_checker->getConfigForPath($current_dir, $current_dir); } if (array_key_exists('issues', $options)) { if (!is_string($options['issues']) || !$options['issues']) { die('Expecting a comma-separated list of issues' . PHP_EOL); } $issues = explode(',', $options['issues']); $keyed_issues = []; foreach ($issues as $issue) { $keyed_issues[$issue] = true; } } else { $keyed_issues = []; } $php_major_version = PHP_MAJOR_VERSION; $php_minor_version = PHP_MINOR_VERSION; if (isset($options['php-version'])) { if (!is_string($options['php-version']) || !preg_match('/^(5\.[456]|7\.[012])^/', $options['php-version'])) { die('Expecting a version number in the format x.y' . PHP_EOL); } list($php_major_version, $php_minor_version) = explode('.', $options['php-version']); } $plugins = []; if (isset($options['plugin'])) { $plugins = $options['plugin']; if (!is_array($plugins)) { $plugins = [$plugins]; } } /** @var string $plugin_path */ foreach ($plugins as $plugin_path) { Config::getInstance()->addPluginPath($current_dir . DIRECTORY_SEPARATOR . $plugin_path); } $project_checker->alterCodeAfterCompletion( (int) $php_major_version, (int) $php_minor_version, array_key_exists('dry-run', $options) ); $project_checker->setIssuesToFix($keyed_issues); /** @psalm-suppress MixedArgument */ \Psalm\IssueBuffer::setStartTime(microtime(true)); if ($paths_to_check === null) { $project_checker->check($current_dir); } elseif ($paths_to_check) { foreach ($paths_to_check as $path_to_check) { if (is_dir($path_to_check)) { $project_checker->checkDir($path_to_check); } else { $project_checker->checkFile($path_to_check); } } }