mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Fix copy/paste fail and other psalm/cs issues, reduce duplication of literals.
This commit is contained in:
parent
5cd3b68ab3
commit
c2b44ff073
@ -46,6 +46,7 @@ use UnexpectedValueException;
|
||||
use XdgBaseDir\Xdg;
|
||||
use stdClass;
|
||||
|
||||
use function array_key_exists;
|
||||
use function array_map;
|
||||
use function array_merge;
|
||||
use function array_pad;
|
||||
@ -999,33 +1000,19 @@ class Config
|
||||
throw new UnexpectedValueException('Invalid composer.json at ' . $composer_json_path);
|
||||
}
|
||||
}
|
||||
foreach ([
|
||||
"decimal",
|
||||
"dom",
|
||||
"ds",
|
||||
"geos",
|
||||
"mongodb",
|
||||
"mysqli",
|
||||
"pdo",
|
||||
"soap",
|
||||
"xdebug",
|
||||
] as $ext) {
|
||||
foreach ($config->php_extensions as $ext => $_) {
|
||||
$config->php_extensions[$ext] = isset($composer_json["require"]["ext-$ext"]);
|
||||
}
|
||||
|
||||
if ($config->load_xdebug_stub !== null) {
|
||||
$config->php_extensions[$ext] = $config->load_xdebug_stub;
|
||||
$config->php_extensions["xdebug"] = $config->load_xdebug_stub;
|
||||
}
|
||||
|
||||
if (isset($config_xml->enableExtensions) && isset($config_xml->enableExtensions->extension)) {
|
||||
foreach ($config_xml->enableExtensions->extension as $extension) {
|
||||
assert(isset($extension["name"]));
|
||||
$extensionName = (string) $extension["name"];
|
||||
assert(in_array(
|
||||
$extensionName,
|
||||
["decimal", "dom", "ds", "geos", "mongodb", "mysqli", "pdo", "soap", "xdebug"],
|
||||
true
|
||||
));
|
||||
assert(array_key_exists($extensionName, $config->php_extensions));
|
||||
$config->php_extensions[$extensionName] = true;
|
||||
}
|
||||
}
|
||||
@ -1034,11 +1021,7 @@ class Config
|
||||
foreach ($config_xml->disableExtensions->extension as $extension) {
|
||||
assert(isset($extension["name"]));
|
||||
$extensionName = (string) $extension["name"];
|
||||
assert(in_array(
|
||||
$extensionName,
|
||||
["decimal", "dom", "ds", "geos", "mongodb", "mysqli", "pdo", "soap", "xdebug"],
|
||||
true
|
||||
));
|
||||
assert(array_key_exists($extensionName, $config->php_extensions));
|
||||
$config->php_extensions[$extensionName] = false;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Psalm\Tests\Config;
|
||||
|
||||
use Psalm\Config;
|
||||
use Psalm\Exception\ConfigException;
|
||||
use Psalm\Internal\PluginManager\ConfigFile;
|
||||
use Psalm\Internal\RuntimeCaches;
|
||||
use Psalm\Tests\TestCase;
|
||||
@ -16,7 +17,6 @@ use function trim;
|
||||
use function unlink;
|
||||
|
||||
use const PHP_EOL;
|
||||
use Psalm\Exception\ConfigException;
|
||||
|
||||
/** @group PluginManager */
|
||||
class ConfigFileTest extends TestCase
|
||||
|
Loading…
Reference in New Issue
Block a user