Detect duplicate keys in composer.json, fixes #4620
parent
dbcf8cae13
commit
e87190e3da
|
@ -26,7 +26,7 @@
|
|||
"justinrainbow/json-schema": "^1.4.4",
|
||||
"composer/spdx-licenses": "^1.0",
|
||||
"composer/semver": "^1.0",
|
||||
"seld/jsonlint": "^1.0",
|
||||
"seld/jsonlint": "^1.4",
|
||||
"symfony/console": "^2.5 || ^3.0",
|
||||
"symfony/finder": "^2.2 || ^3.0",
|
||||
"symfony/process": "^2.1 || ^3.0",
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "c88bd0dc7f99b674776d931973d3e1b7",
|
||||
"content-hash": "e31b609879971d42d37f09bb6a526192",
|
||||
"hash": "93e6b0b69e1d2831beb016b291320e65",
|
||||
"content-hash": "e50c021dd9230b14ee88fe3d62c3923f",
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/semver",
|
||||
|
@ -246,20 +246,20 @@
|
|||
},
|
||||
{
|
||||
"name": "seld/jsonlint",
|
||||
"version": "1.3.1",
|
||||
"version": "1.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/jsonlint.git",
|
||||
"reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4"
|
||||
"reference": "66834d3e3566bb5798db7294619388786ae99394"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/863ae85c6d3ef60ca49cb12bd051c4a0648c40c4",
|
||||
"reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4",
|
||||
"url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/66834d3e3566bb5798db7294619388786ae99394",
|
||||
"reference": "66834d3e3566bb5798db7294619388786ae99394",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
"php": "^5.3 || ^7.0"
|
||||
},
|
||||
"bin": [
|
||||
"bin/jsonlint"
|
||||
|
@ -288,7 +288,7 @@
|
|||
"parser",
|
||||
"validator"
|
||||
],
|
||||
"time": "2015-01-04 21:18:15"
|
||||
"time": "2015-11-21 02:21:41"
|
||||
},
|
||||
{
|
||||
"name": "seld/phar-utils",
|
||||
|
|
|
@ -25,6 +25,7 @@ use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
|||
use Composer\EventDispatcher\EventDispatcher;
|
||||
use Composer\Autoload\AutoloadGenerator;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Seld\JsonLint\JsonParser;
|
||||
|
||||
/**
|
||||
* Creates a configured instance of composer.
|
||||
|
@ -219,6 +220,14 @@ class Factory
|
|||
}
|
||||
|
||||
$file->validateSchema(JsonFile::LAX_SCHEMA);
|
||||
$jsonParser = new JsonParser;
|
||||
try {
|
||||
$jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
|
||||
} catch (\Seld\JsonLint\DuplicateKeyException $e) {
|
||||
$details = $e->getDetails();
|
||||
$io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
|
||||
}
|
||||
|
||||
$localConfig = $file->read();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue