diff --git a/.travis.yml b/.travis.yml index 400ab948..575ca787 100644 --- a/.travis.yml +++ b/.travis.yml @@ -129,7 +129,7 @@ jobs: - xdebug-enable script: - - vendor/bin/infection --min-covered-msi=80 --min-msi=60 + - vendor/bin/infection --min-covered-msi=80 --min-msi=47 notifications: email: false diff --git a/CHANGELOG.md b/CHANGELOG.md index da09f4a4..b861cb44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/localheinz/composer-normalize/compare/0.9.0...HEAD) ([`0.9.0...master`](https://github.com/localheinz/composer-normalize/compare/0.9.0...master)) +## Unreleased + +For a full diff see [`1.0.0...master`](https://github.com/localheinz/composer-normalize/compare/1.0.0...master). + +## [`1.0.0`](https://github.com/localheinz/composer-normalize/releases/tag/1.0.0) + +For a full diff see [`0.9.0...1.0.0`](https://github.com/localheinz/composer-normalize/compare/0.9.0...1.0.0). ### Added * Added this changelog ([#94](https://github.com/localheinz/composer-normalize/pull/#94)), by [@localheinz](https://github.com/localheinz) -## [`0.9.0`](https://github.com/localheinz/composer-normalize/releases/tag/0.9.0) +### Removed + +* Removed normalizers after extracting package [`localheinz/composer-json-normalizer`](https://github.com/localheinz/composer-json-normalizer) ([#106](https://github.com/localheinz/composer-normalize/pull/#106)), by [@localheinz](https://github.com/localheinz) + +## [`0.9.0`](https://github.com/localheinz/composer-normalize/releases/tag/0.9.0) For a full diff see [`0.8.0...0.9.0`](https://github.com/localheinz/composer-normalize/compare/0.8.0...0.9.0). diff --git a/Makefile b/Makefile index dd112e99..9e2341d5 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ cs: vendor vendor/bin/php-cs-fixer fix --config=.php_cs --diff --verbose infection: - vendor/bin/infection --min-covered-msi=80 --min-msi=60 + vendor/bin/infection --min-covered-msi=80 --min-msi=47 stan: vendor vendor/bin/phpstan analyse --configuration=phpstan.neon --level=max src diff --git a/README.md b/README.md index 47b01428..fd362f80 100644 --- a/README.md +++ b/README.md @@ -54,11 +54,14 @@ The `NormalizeCommand` provided by the `NormalizePlugin` within this package wil * determine whether a `composer.json` exists * determine whether a `composer.lock` exists, and if so, whether it is up to date -* use the `ComposerJsonNormalizer` to normalize the content of `composer.json` +* use the `ComposerJsonNormalizer` from [`localheinz/composer-json-normalizer`](https://github.com/localheinz/composer-json-normalizer) to normalize the content of `composer.json` * format the normalized content (either as sniffed, or as specified using the `--indent-size` and `--indent-style` options) * write the normalized and formatted content of `composer.json` back to the file * update the hash in `composer.lock` if it exists and if an update is necessary +:bulb: Interested in what `ComposerJsonNormalizer` does? Head over to +[`localheinz/composer-json-normalizer`](https://github.com/localheinz/composer-json-normalizer#normalizers) for a full explanation. + ### Arguments * `file`: Path to composer.json file (optional, defaults to `composer.json` in working directory) @@ -70,77 +73,6 @@ The `NormalizeCommand` provided by the `NormalizePlugin` within this package wil * `--indent-style`: Indent style (one of "space", "tab"); should be used with the `--indent-size` option * `--no-update-lock`: Do not update lock file if it exists -## Normalizers - -The `ComposerJsonNormalizer` composes normalizers provided by [`localheinz/json-normalizer`](https://github.com/localheinz/json-normalizer): - -* [`Localheinz\Json\Normalizer\ChainNormalizer`](https://github.com/localheinz/json-normalizer#chainnormalizer) -* [`Localheinz\Json\Normalizer\SchemaNormalizer`](https://github.com/localheinz/json-normalizer#schemanormalizer) - -as well as the following normalizers provided by this package: - -* [`Localheinz\Composer\Normalize\Normalizer\BinNormalizer`](#binnormalizer) -* [`Localheinz\Composer\Normalize\Normalizer\ConfigHashNormalizer`](#confighashnormalizer) -* [`Localheinz\Composer\Normalize\Normalizer\PackageHashNormalizer`](#packagehashnormalizer) -* [`Localheinz\Composer\Normalize\Normalizer\VersionConstraintNormalizer`](#versionconstraintnormalizer) - -### `BinNormalizer` - -If `composer.json` contains an array of scripts in the `bin` section, -the `BinNormalizer` will sort the elements of the `bin` section by value in ascending order. - -:bulb: Find out more about the `bin` section at https://getcomposer.org/doc/04-schema.md#bin. - -### `ConfigHashNormalizer` - -If `composer.json` contains any configuration in the - -* `config` -* `extra` -* `scripts-descriptions` - -sections, the `ConfigHashNormalizer` will sort the content of these sections -by key in ascending order. - -:bulb: Find out more about the `config` section at https://getcomposer.org/doc/06-config.md. - -### `PackageHashNormalizer` - -If `composer.json` contains any configuration in the - -* `conflict` -* `provide` -* `replace` -* `require` -* `require-dev` -* `suggest` - -sections, the `PackageHashNormalizer` will sort the content of these sections. - -:bulb: This transfers the behaviour from using the `--sort-packages` or -`sort-packages` configuration flag to other sections. Find out more about -the `--sort-packages` flag and configuration at https://getcomposer.org/doc/06-config.md#sort-packages -and https://getcomposer.org/doc/03-cli.md#require. - -### `VersionConstraintNormalizer` - -If `composer.json` contains version constraints in the - -* `conflict` -* `provide` -* `replace` -* `require` -* `require-dev` - -sections, the `VersionConstraintNormalizer` will ensure that - -* all constraints are trimmed -* *and* constraints are separated by a single space (` `) or a comma (`,`) -* *or* constraints are separated by double-pipe with a single space before and after (` || `) -* *range* constraints are separated by a single space (` `) - -:bulb: Find out more about version constraints at https://getcomposer.org/doc/articles/versions.md. - ## Changelog Please have a look at [`CHANGELOG.md`](CHANGELOG.md). @@ -157,14 +89,6 @@ Please have a look at [`CODE_OF_CONDUCT.md`](.github/CODE_OF_CONDUCT.md). This package is licensed using the MIT License. -## Credits - -The algorithm for sorting packages in the [`PackageHashNormalizer`](src/Normalizer/PackageHashNormalizer.php) has -been adopted from [`Composer\Json\JsonManipulator::sortPackages()`](https://github.com/composer/composer/blob/1.6.2/src/Composer/Json/JsonManipulator.php#L110-L146) -(originally licensed under MIT by [Nils Adermann](https://github.com/naderman) and [Jordi Boggiano](https://github.com/seldaek)), -which I initially contributed to `composer/composer` with [`composer/composer#3549`](https://github.com/composer/composer/pull/3549) -and [`composer/composer#3872`](https://github.com/composer/composer/pull/3872). - ## Services `localheinz/composer-normalize` is currently in use by [FlintCI](https://flintci.io), see https://flintci.io/docs#composernormalize. diff --git a/composer.json b/composer.json index 9ea235e9..3023b708 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ "require": { "php": "^7.1", "composer-plugin-api": "^1.1.0", + "localheinz/composer-json-normalizer": "^1.0.1", "localheinz/json-normalizer": "~0.9.0", "sebastian/diff": "^2.0.1 || ^3.0.0", "symfony/console": "^2.5.0 || ^3.0.0 || ^4.0.0" diff --git a/composer.lock b/composer.lock index 84ac42ce..8ddcb6e5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,264 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1348aa90a52613770bbe8a798541230a", + "content-hash": "77bc7779c6b3d9c53bd1e3c2ef2f970e", "packages": [ + { + "name": "composer/ca-bundle", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/composer/ca-bundle.git", + "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660", + "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-pcre": "*", + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5", + "psr/log": "^1.0", + "symfony/process": "^2.5 || ^3.0 || ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\CaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "keywords": [ + "cabundle", + "cacert", + "certificate", + "ssl", + "tls" + ], + "time": "2018-10-18T06:09:13+00:00" + }, + { + "name": "composer/composer", + "version": "1.6.2", + "source": { + "type": "git", + "url": "https://github.com/composer/composer.git", + "reference": "db191abd24b0be110c98ba2271ca992e1c70962f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/composer/zipball/db191abd24b0be110c98ba2271ca992e1c70962f", + "reference": "db191abd24b0be110c98ba2271ca992e1c70962f", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.0", + "composer/semver": "^1.0", + "composer/spdx-licenses": "^1.2", + "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", + "php": "^5.3.2 || ^7.0", + "psr/log": "^1.0", + "seld/cli-prompt": "^1.0", + "seld/jsonlint": "^1.4", + "seld/phar-utils": "^1.0", + "symfony/console": "^2.7 || ^3.0 || ^4.0", + "symfony/filesystem": "^2.7 || ^3.0 || ^4.0", + "symfony/finder": "^2.7 || ^3.0 || ^4.0", + "symfony/process": "^2.7 || ^3.0 || ^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7", + "phpunit/phpunit-mock-objects": "^2.3 || ^3.0" + }, + "suggest": { + "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", + "ext-zip": "Enabling the zip extension allows you to unzip archives", + "ext-zlib": "Allow gzip compression of HTTP requests" + }, + "bin": [ + "bin/composer" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\": "src/Composer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.", + "homepage": "https://getcomposer.org/", + "keywords": [ + "autoload", + "dependency", + "package" + ], + "time": "2018-01-05T14:28:42+00:00" + }, + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2016-08-30T16:08:34+00:00" + }, + { + "name": "composer/spdx-licenses", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/composer/spdx-licenses.git", + "reference": "2d899e9b33023c631854f36c39ef9f8317a7ab33" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/2d899e9b33023c631854f36c39ef9f8317a7ab33", + "reference": "2d899e9b33023c631854f36c39ef9f8317a7ab33", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Spdx\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "SPDX licenses list and validation library.", + "keywords": [ + "license", + "spdx", + "validator" + ], + "time": "2018-01-03T16:37:06+00:00" + }, { "name": "justinrainbow/json-schema", "version": "5.2.7", @@ -21,89 +277,340 @@ "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.1", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.35" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "time": "2018-02-14T22:26:30+00:00" + }, + { + "name": "localheinz/composer-json-normalizer", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/localheinz/composer-json-normalizer.git", + "reference": "9e7127e59b0f18fb2346c49d38d32586eaaebdd4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/localheinz/composer-json-normalizer/zipball/9e7127e59b0f18fb2346c49d38d32586eaaebdd4", + "reference": "9e7127e59b0f18fb2346c49d38d32586eaaebdd4", + "shasum": "" + }, + "require": { + "composer/composer": "^1.1.0", + "localheinz/json-normalizer": "~0.9.0", + "php": "^7.1" + }, + "require-dev": { + "infection/infection": "~0.11.1", + "localheinz/php-cs-fixer-config": "~1.16.0", + "localheinz/phpstan-rules": "~0.2.0", + "localheinz/test-util": "~0.7.0", + "phpstan/phpstan": "~0.10.5", + "phpstan/phpstan-strict-rules": "~0.10.1", + "phpunit/phpunit": "^7.4.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Localheinz\\Composer\\Json\\Normalizer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Möller", + "email": "am@localheinz.com" + } + ], + "description": "Provides normalizers for normalizing composer.json.", + "homepage": "https://github.com/localheinz/composer-json-normalizer", + "keywords": [ + "composer", + "json", + "normalizer" + ], + "time": "2018-11-17T15:06:04+00:00" + }, + { + "name": "localheinz/json-normalizer", + "version": "0.9.0", + "source": { + "type": "git", + "url": "https://github.com/localheinz/json-normalizer.git", + "reference": "28eeda6f1f0daa3c9c28ad0651d95478fe1a5059" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/localheinz/json-normalizer/zipball/28eeda6f1f0daa3c9c28ad0651d95478fe1a5059", + "reference": "28eeda6f1f0daa3c9c28ad0651d95478fe1a5059", + "shasum": "" + }, + "require": { + "ext-json": "*", + "justinrainbow/json-schema": "^4.0.0 || ^5.0.0", + "localheinz/json-printer": "^2.0.1", + "php": "^7.1" + }, + "require-dev": { + "infection/infection": "~0.10.5", + "localheinz/php-cs-fixer-config": "~1.15.0", + "localheinz/test-util": "~0.7.0", + "phpbench/phpbench": "~0.14.0", + "phpstan/phpstan": "~0.10.3", + "phpunit/phpunit": "^7.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Localheinz\\Json\\Normalizer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Möller", + "email": "am@localheinz.com" + } + ], + "description": "Provides normalizers for normalizing JSON documents.", + "homepage": "https://github.com/localheinz/json-normalizer", + "keywords": [ + "json", + "normalizer" + ], + "time": "2018-10-07T17:36:39+00:00" + }, + { + "name": "localheinz/json-printer", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/localheinz/json-printer.git", + "reference": "86f942599c8f9f922de4e21c2b9b6564c895cb0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/localheinz/json-printer/zipball/86f942599c8f9f922de4e21c2b9b6564c895cb0c", + "reference": "86f942599c8f9f922de4e21c2b9b6564c895cb0c", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "infection/infection": "~0.8.1", + "localheinz/php-cs-fixer-config": "~1.14.0", + "localheinz/test-util": "0.6.1", + "phpbench/phpbench": "~0.14.0", + "phpunit/phpunit": "^6.5.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Localheinz\\Json\\Printer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Möller", + "email": "am@localheinz.com" + } + ], + "description": "Provides a JSON printer, allowing for flexible indentation.", + "homepage": "https://github.com/localheinz/json-printer", + "keywords": [ + "formatter", + "json", + "printer" + ], + "time": "2018-08-11T23:54:50+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "e09160918c66281713f1c324c1f4c4c3037ba1e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/e09160918c66281713f1c324c1f4c4c3037ba1e8", + "reference": "e09160918c66281713f1c324c1f4c4c3037ba1e8", + "shasum": "" + }, + "require": { + "php": "^7.1" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.1", - "json-schema/json-schema-test-suite": "1.2.0", - "phpunit/phpunit": "^4.8.35" + "phpunit/phpunit": "^7.0", + "symfony/process": "^2 || ^3.3 || ^4" }, - "bin": [ - "bin/validate-json" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" }, { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "json", - "schema" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2018-02-14T22:26:30+00:00" + "time": "2018-02-01T13:45:15+00:00" }, { - "name": "localheinz/json-normalizer", - "version": "0.9.0", + "name": "seld/cli-prompt", + "version": "1.0.3", "source": { "type": "git", - "url": "https://github.com/localheinz/json-normalizer.git", - "reference": "28eeda6f1f0daa3c9c28ad0651d95478fe1a5059" + "url": "https://github.com/Seldaek/cli-prompt.git", + "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/localheinz/json-normalizer/zipball/28eeda6f1f0daa3c9c28ad0651d95478fe1a5059", - "reference": "28eeda6f1f0daa3c9c28ad0651d95478fe1a5059", + "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd", + "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd", "shasum": "" }, "require": { - "ext-json": "*", - "justinrainbow/json-schema": "^4.0.0 || ^5.0.0", - "localheinz/json-printer": "^2.0.1", - "php": "^7.1" - }, - "require-dev": { - "infection/infection": "~0.10.5", - "localheinz/php-cs-fixer-config": "~1.15.0", - "localheinz/test-util": "~0.7.0", - "phpbench/phpbench": "~0.14.0", - "phpstan/phpstan": "~0.10.3", - "phpunit/phpunit": "^7.4.0" + "php": ">=5.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, "autoload": { "psr-4": { - "Localheinz\\Json\\Normalizer\\": "src/" + "Seld\\CliPrompt\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -112,46 +619,47 @@ ], "authors": [ { - "name": "Andreas Möller", - "email": "am@localheinz.com" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" } ], - "description": "Provides normalizers for normalizing JSON documents.", - "homepage": "https://github.com/localheinz/json-normalizer", + "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type", "keywords": [ - "json", - "normalizer" + "cli", + "console", + "hidden", + "input", + "prompt" ], - "time": "2018-10-07T17:36:39+00:00" + "time": "2017-03-18T11:32:45+00:00" }, { - "name": "localheinz/json-printer", - "version": "2.0.1", + "name": "seld/jsonlint", + "version": "1.7.0", "source": { "type": "git", - "url": "https://github.com/localheinz/json-printer.git", - "reference": "86f942599c8f9f922de4e21c2b9b6564c895cb0c" + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "9b355654ea99460397b89c132b5c1087b6bf4473" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/localheinz/json-printer/zipball/86f942599c8f9f922de4e21c2b9b6564c895cb0c", - "reference": "86f942599c8f9f922de4e21c2b9b6564c895cb0c", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9b355654ea99460397b89c132b5c1087b6bf4473", + "reference": "9b355654ea99460397b89c132b5c1087b6bf4473", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^5.3 || ^7.0" }, "require-dev": { - "infection/infection": "~0.8.1", - "localheinz/php-cs-fixer-config": "~1.14.0", - "localheinz/test-util": "0.6.1", - "phpbench/phpbench": "~0.14.0", - "phpunit/phpunit": "^6.5.7" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, + "bin": [ + "bin/jsonlint" + ], "type": "library", "autoload": { "psr-4": { - "Localheinz\\Json\\Printer\\": "src/" + "Seld\\JsonLint\\": "src/Seld/JsonLint/" } }, "notification-url": "https://packagist.org/downloads/", @@ -160,74 +668,63 @@ ], "authors": [ { - "name": "Andreas Möller", - "email": "am@localheinz.com" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" } ], - "description": "Provides a JSON printer, allowing for flexible indentation.", - "homepage": "https://github.com/localheinz/json-printer", + "description": "JSON Linter", "keywords": [ - "formatter", "json", - "printer" + "linter", + "parser", + "validator" ], - "time": "2018-08-11T23:54:50+00:00" + "time": "2018-01-03T12:13:57+00:00" }, { - "name": "sebastian/diff", - "version": "3.0.0", + "name": "seld/phar-utils", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "e09160918c66281713f1c324c1f4c4c3037ba1e8" + "url": "https://github.com/Seldaek/phar-utils.git", + "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/e09160918c66281713f1c324c1f4c4c3037ba1e8", - "reference": "e09160918c66281713f1c324c1f4c4c3037ba1e8", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a", + "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a", "shasum": "" }, "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0", - "symfony/process": "^2 || ^3.3 || ^4" + "php": ">=5.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "1.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Seld\\PharUtils\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" } ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", + "description": "PHAR file format utilities, for when PHP phars you up", "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" + "phra" ], - "time": "2018-02-01T13:45:15+00:00" + "time": "2015-10-13T18:44:15+00:00" }, { "name": "symfony/console", @@ -298,37 +795,35 @@ "time": "2018-07-26T11:24:31+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", + "name": "symfony/filesystem", + "version": "v4.1.7", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" + "url": "https://github.com/symfony/filesystem.git", + "reference": "fd7bd6535beb1f0a0a9e3ee960666d0598546981" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/fd7bd6535beb1f0a0a9e3ee960666d0598546981", + "reference": "fd7bd6535beb1f0a0a9e3ee960666d0598546981", "shasum": "" }, "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "4.1-dev" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Component\\Filesystem\\": "" }, - "files": [ - "bootstrap.php" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -337,61 +832,48 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2018-04-26T10:06:28+00:00" - } - ], - "packages-dev": [ + "time": "2018-10-30T13:18:25+00:00" + }, { - "name": "composer/ca-bundle", - "version": "1.1.3", + "name": "symfony/finder", + "version": "v4.1.7", "source": { "type": "git", - "url": "https://github.com/composer/ca-bundle.git", - "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660" + "url": "https://github.com/symfony/finder.git", + "reference": "1f17195b44543017a9c9b2d437c670627e96ad06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660", - "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660", + "url": "https://api.github.com/repos/symfony/finder/zipball/1f17195b44543017a9c9b2d437c670627e96ad06", + "reference": "1f17195b44543017a9c9b2d437c670627e96ad06", "shasum": "" }, "require": { - "ext-openssl": "*", - "ext-pcre": "*", - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5", - "psr/log": "^1.0", - "symfony/process": "^2.5 || ^3.0 || ^4.0" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "4.1-dev" } }, "autoload": { "psr-4": { - "Composer\\CaBundle\\": "src" - } + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -399,72 +881,51 @@ ], "authors": [ { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", - "keywords": [ - "cabundle", - "cacert", - "certificate", - "ssl", - "tls" - ], - "time": "2018-10-18T06:09:13+00:00" + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2018-10-03T08:47:56+00:00" }, { - "name": "composer/composer", - "version": "1.6.2", + "name": "symfony/polyfill-ctype", + "version": "v1.10.0", "source": { "type": "git", - "url": "https://github.com/composer/composer.git", - "reference": "db191abd24b0be110c98ba2271ca992e1c70962f" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/db191abd24b0be110c98ba2271ca992e1c70962f", - "reference": "db191abd24b0be110c98ba2271ca992e1c70962f", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", "shasum": "" }, "require": { - "composer/ca-bundle": "^1.0", - "composer/semver": "^1.0", - "composer/spdx-licenses": "^1.2", - "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", - "php": "^5.3.2 || ^7.0", - "psr/log": "^1.0", - "seld/cli-prompt": "^1.0", - "seld/jsonlint": "^1.4", - "seld/phar-utils": "^1.0", - "symfony/console": "^2.7 || ^3.0 || ^4.0", - "symfony/filesystem": "^2.7 || ^3.0 || ^4.0", - "symfony/finder": "^2.7 || ^3.0 || ^4.0", - "symfony/process": "^2.7 || ^3.0 || ^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7", - "phpunit/phpunit-mock-objects": "^2.3 || ^3.0" + "php": ">=5.3.3" }, "suggest": { - "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", - "ext-zip": "Enabling the zip extension allows you to unzip archives", - "ext-zlib": "Allow gzip compression of HTTP requests" + "ext-ctype": "For best performance" }, - "bin": [ - "bin/composer" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "1.9-dev" } }, "autoload": { "psr-4": { - "Composer\\": "src/Composer" - } + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -472,56 +933,57 @@ ], "authors": [ { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" }, { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" } ], - "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.", - "homepage": "https://getcomposer.org/", + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", "keywords": [ - "autoload", - "dependency", - "package" + "compatibility", + "ctype", + "polyfill", + "portable" ], - "time": "2018-01-05T14:28:42+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { - "name": "composer/semver", - "version": "1.4.2", + "name": "symfony/polyfill-mbstring", + "version": "v1.8.0", "source": { "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "3296adf6a6454a050679cde90f95350ad604b171" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", + "reference": "3296adf6a6454a050679cde90f95350ad604b171", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0" + "php": ">=5.3.3" }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + "suggest": { + "ext-mbstring": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "1.8-dev" } }, "autoload": { "psr-4": { - "Composer\\Semver\\": "src" - } + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -529,61 +991,55 @@ ], "authors": [ { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", "keywords": [ - "semantic", - "semver", - "validation", - "versioning" + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" ], - "time": "2016-08-30T16:08:34+00:00" + "time": "2018-04-26T10:06:28+00:00" }, { - "name": "composer/spdx-licenses", - "version": "1.2.0", + "name": "symfony/process", + "version": "v4.1.7", "source": { "type": "git", - "url": "https://github.com/composer/spdx-licenses.git", - "reference": "2d899e9b33023c631854f36c39ef9f8317a7ab33" + "url": "https://github.com/symfony/process.git", + "reference": "3e83acef94d979b1de946599ef86b3a352abcdc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/2d899e9b33023c631854f36c39ef9f8317a7ab33", - "reference": "2d899e9b33023c631854f36c39ef9f8317a7ab33", + "url": "https://api.github.com/repos/symfony/process/zipball/3e83acef94d979b1de946599ef86b3a352abcdc9", + "reference": "3e83acef94d979b1de946599ef86b3a352abcdc9", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "4.1-dev" } }, "autoload": { "psr-4": { - "Composer\\Spdx\\": "src" - } + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -591,29 +1047,20 @@ ], "authors": [ { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "SPDX licenses list and validation library.", - "keywords": [ - "license", - "spdx", - "validator" - ], - "time": "2018-01-03T16:37:06+00:00" - }, + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2018-10-14T20:48:13+00:00" + } + ], + "packages-dev": [ { "name": "composer/xdebug-handler", "version": "1.3.0", @@ -3060,63 +3507,14 @@ "name": "psr/container", "version": "1.0.0", "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-02-14T16:28:37+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", "shasum": "" }, "require": { @@ -3130,7 +3528,7 @@ }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Container\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -3143,14 +3541,16 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", "keywords": [ - "log", - "psr", - "psr-3" + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2017-02-14T16:28:37+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -3550,386 +3950,146 @@ "autoload": { "classmap": [ "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "seld/cli-prompt", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/cli-prompt.git", - "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd", - "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Seld\\CliPrompt\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type", - "keywords": [ - "cli", - "console", - "hidden", - "input", - "prompt" - ], - "time": "2017-03-18T11:32:45+00:00" - }, - { - "name": "seld/jsonlint", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "9b355654ea99460397b89c132b5c1087b6bf4473" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9b355654ea99460397b89c132b5c1087b6bf4473", - "reference": "9b355654ea99460397b89c132b5c1087b6bf4473", - "shasum": "" - }, - "require": { - "php": "^5.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "bin": [ - "bin/jsonlint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Seld\\JsonLint\\": "src/Seld/JsonLint/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "JSON Linter", - "keywords": [ - "json", - "linter", - "parser", - "validator" - ], - "time": "2018-01-03T12:13:57+00:00" - }, - { - "name": "seld/phar-utils", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a", - "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Seld\\PharUtils\\": "src/" - } + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], - "description": "PHAR file format utilities, for when PHP phars you up", - "keywords": [ - "phra" - ], - "time": "2015-10-13T18:44:15+00:00" + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" }, { - "name": "symfony/event-dispatcher", - "version": "v4.1.4", + "name": "sebastian/resource-operations", + "version": "2.0.1", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e" + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bfb30c2ad377615a463ebbc875eba64a99f6aa3e", - "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": "^7.1.3" - }, - "conflict": { - "symfony/dependency-injection": "<3.4" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/stopwatch": "~3.4|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2018-07-26T09:10:45+00:00" + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2018-10-04T04:07:39+00:00" }, { - "name": "symfony/filesystem", - "version": "v4.1.7", + "name": "sebastian/version", + "version": "2.0.1", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "fd7bd6535beb1f0a0a9e3ee960666d0598546981" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/fd7bd6535beb1f0a0a9e3ee960666d0598546981", - "reference": "fd7bd6535beb1f0a0a9e3ee960666d0598546981", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/polyfill-ctype": "~1.8" + "php": ">=5.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2018-10-30T13:18:25+00:00" + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" }, { - "name": "symfony/finder", - "version": "v4.1.7", + "name": "symfony/event-dispatcher", + "version": "v4.1.4", "source": { "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "1f17195b44543017a9c9b2d437c670627e96ad06" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/1f17195b44543017a9c9b2d437c670627e96ad06", - "reference": "1f17195b44543017a9c9b2d437c670627e96ad06", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bfb30c2ad377615a463ebbc875eba64a99f6aa3e", + "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e", "shasum": "" }, "require": { "php": "^7.1.3" }, + "conflict": { + "symfony/dependency-injection": "<3.4" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/stopwatch": "~3.4|~4.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, "type": "library", "extra": { "branch-alias": { @@ -3938,7 +4098,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Component\\Finder\\": "" + "Symfony\\Component\\EventDispatcher\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -3958,9 +4118,9 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-10-03T08:47:56+00:00" + "time": "2018-07-26T09:10:45+00:00" }, { "name": "symfony/options-resolver", @@ -4016,64 +4176,6 @@ ], "time": "2018-07-26T08:55:25+00:00" }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.10.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2018-08-06T14:22:27+00:00" - }, { "name": "symfony/polyfill-php70", "version": "v1.9.0", @@ -4188,55 +4290,6 @@ ], "time": "2018-08-06T14:22:27+00:00" }, - { - "name": "symfony/process", - "version": "v4.1.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "3e83acef94d979b1de946599ef86b3a352abcdc9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/3e83acef94d979b1de946599ef86b3a352abcdc9", - "reference": "3e83acef94d979b1de946599ef86b3a352abcdc9", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2018-10-14T20:48:13+00:00" - }, { "name": "symfony/stopwatch", "version": "v4.1.4", diff --git a/src/NormalizePlugin.php b/src/NormalizePlugin.php index 2fc1f9e0..e8013e0a 100644 --- a/src/NormalizePlugin.php +++ b/src/NormalizePlugin.php @@ -17,6 +17,7 @@ use Composer\Factory; use Composer\IO; use Composer\Plugin; +use Localheinz\Composer\Json\Normalizer; final class NormalizePlugin implements Plugin\PluginInterface, Plugin\Capable, Plugin\Capability\CommandProvider { diff --git a/src/Normalizer/BinNormalizer.php b/src/Normalizer/BinNormalizer.php deleted file mode 100644 index a7c41262..00000000 --- a/src/Normalizer/BinNormalizer.php +++ /dev/null @@ -1,43 +0,0 @@ -decoded(); - - if (!\is_object($decoded) - || !\property_exists($decoded, 'bin') - || !\is_array($decoded->bin) - ) { - return $json; - } - - $bin = $decoded->bin; - - \sort($bin); - - $decoded->bin = $bin; - - /** @var string $encoded */ - $encoded = \json_encode($decoded); - - return Json::fromEncoded($encoded); - } -} diff --git a/src/Normalizer/ComposerJsonNormalizer.php b/src/Normalizer/ComposerJsonNormalizer.php deleted file mode 100644 index 6a417ec0..00000000 --- a/src/Normalizer/ComposerJsonNormalizer.php +++ /dev/null @@ -1,47 +0,0 @@ -normalizer = new ChainNormalizer( - new SchemaNormalizer($schemaUri), - new BinNormalizer(), - new ConfigHashNormalizer(), - new PackageHashNormalizer(), - new VersionConstraintNormalizer() - ); - } - - public function normalize(Json $json): Json - { - if (!\is_object($json->decoded())) { - return $json; - } - - return $this->normalizer->normalize($json); - } -} diff --git a/src/Normalizer/ConfigHashNormalizer.php b/src/Normalizer/ConfigHashNormalizer.php deleted file mode 100644 index fee75ca5..00000000 --- a/src/Normalizer/ConfigHashNormalizer.php +++ /dev/null @@ -1,68 +0,0 @@ -decoded(); - - if (!\is_object($decoded)) { - return $json; - } - - if (!\is_object($decoded)) { - return $json; - } - - $objectProperties = \array_intersect_key( - \get_object_vars($decoded), - \array_flip(self::$properties) - ); - - if (0 === \count($objectProperties)) { - return $json; - } - - foreach ($objectProperties as $name => $value) { - $config = (array) $decoded->{$name}; - - if (0 === \count($config)) { - return $json; - } - - \ksort($config); - - $decoded->{$name} = $config; - } - - /** @var string $encoded */ - $encoded = \json_encode($decoded); - - return Json::fromEncoded($encoded); - } -} diff --git a/src/Normalizer/PackageHashNormalizer.php b/src/Normalizer/PackageHashNormalizer.php deleted file mode 100644 index dc39c53b..00000000 --- a/src/Normalizer/PackageHashNormalizer.php +++ /dev/null @@ -1,109 +0,0 @@ -decoded(); - - if (!\is_object($decoded)) { - return $json; - } - - $objectProperties = \array_intersect_key( - \get_object_vars($decoded), - \array_flip(self::$properties) - ); - - if (0 === \count($objectProperties)) { - return $json; - } - - foreach ($objectProperties as $name => $value) { - $packages = (array) $decoded->{$name}; - - if (0 === \count($packages)) { - continue; - } - - $decoded->{$name} = $this->sortPackages($packages); - } - - /** @var string $encoded */ - $encoded = \json_encode($decoded); - - return Json::fromEncoded($encoded); - } - - /** - * This code is adopted from composer/composer (originally licensed under MIT by Nils Adermann - * and Jordi Boggiano ). - * - * @see https://github.com/composer/composer/blob/1.6.2/src/Composer/Json/JsonManipulator.php#L110-L146 - * - * @param string[] $packages - * - * @return string[] - */ - private function sortPackages(array $packages): array - { - $prefix = function ($requirement) { - if (1 === \preg_match(Repository\PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) { - return \preg_replace( - [ - '/^php/', - '/^hhvm/', - '/^ext/', - '/^lib/', - '/^\D/', - ], - [ - '0-$0', - '1-$0', - '2-$0', - '3-$0', - '4-$0', - ], - $requirement - ); - } - - return '5-' . $requirement; - }; - - \uksort($packages, function ($a, $b) use ($prefix) { - return \strnatcmp($prefix($a), $prefix($b)); - }); - - return $packages; - } -} diff --git a/src/Normalizer/VersionConstraintNormalizer.php b/src/Normalizer/VersionConstraintNormalizer.php deleted file mode 100644 index 87a0f9a6..00000000 --- a/src/Normalizer/VersionConstraintNormalizer.php +++ /dev/null @@ -1,108 +0,0 @@ - [ - '{\s*,\s*}', - ',', - ], - 'or' => [ - '{\s*\|\|?\s*}', - ' || ', - ], - 'range' => [ - '{\s+}', - ' ', - ], - ]; - - public function normalize(Json $json): Json - { - $decoded = $json->decoded(); - - if (!\is_object($decoded)) { - return $json; - } - - if (!\is_object($decoded)) { - return $json; - } - - $objectProperties = \array_intersect_key( - \get_object_vars($decoded), - \array_flip(self::$properties) - ); - - if (0 === \count($objectProperties)) { - return $json; - } - - foreach ($objectProperties as $name => $value) { - $packages = (array) $decoded->{$name}; - - if (0 === \count($packages)) { - continue; - } - - $decoded->{$name} = \array_map(function (string $versionConstraint) { - return $this->normalizeVersionConstraint($versionConstraint); - }, $packages); - } - - /** @var string $encoded */ - $encoded = \json_encode($decoded); - - return Json::fromEncoded($encoded); - } - - private function normalizeVersionConstraint(string $versionConstraint): string - { - $normalized = $versionConstraint; - - foreach (self::$map as [$pattern, $glue]) { - /** @var string[] $split */ - $split = \preg_split( - $pattern, - $normalized - ); - - $normalized = \implode( - $glue, - $split - ); - } - - return \trim($normalized); - } -} diff --git a/test/Fixture/composer-schema.json b/test/Fixture/composer-schema.json deleted file mode 100644 index 8c61a624..00000000 --- a/test/Fixture/composer-schema.json +++ /dev/null @@ -1,835 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "name": "Package", - "type": "object", - "additionalProperties": false, - "required": [ "name", "description" ], - "properties": { - "name": { - "type": "string", - "description": "Package name, including 'vendor-name/' prefix." - }, - "type": { - "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.", - "type": "string" - }, - "target-dir": { - "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.", - "type": "string" - }, - "description": { - "type": "string", - "description": "Short package description." - }, - "keywords": { - "type": "array", - "items": { - "type": "string", - "description": "A tag/keyword that this package relates to." - } - }, - "homepage": { - "type": "string", - "description": "Homepage URL for the project.", - "format": "uri" - }, - "version": { - "type": "string", - "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes." - }, - "time": { - "type": "string", - "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format." - }, - "license": { - "type": ["string", "array"], - "description": "License name. Or an array of license names." - }, - "authors": { - "$ref": "#/definitions/authors" - }, - "require": { - "type": "object", - "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.", - "additionalProperties": { - "type": "string" - } - }, - "replace": { - "type": "object", - "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.", - "additionalProperties": { - "type": "string" - } - }, - "conflict": { - "type": "object", - "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.", - "additionalProperties": { - "type": "string" - } - }, - "provide": { - "type": "object", - "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.", - "additionalProperties": { - "type": "string" - } - }, - "require-dev": { - "type": "object", - "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).", - "additionalProperties": { - "type": "string" - } - }, - "suggest": { - "type": "object", - "description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).", - "additionalProperties": { - "type": "string" - } - }, - "config": { - "type": "object", - "description": "Composer options.", - "properties": { - "process-timeout": { - "type": "integer", - "description": "The timeout in seconds for process executions, defaults to 300 (5mins)." - }, - "use-include-path": { - "type": "boolean", - "description": "If true, the Composer autoloader will also look for classes in the PHP include path." - }, - "preferred-install": { - "type": ["string", "object"], - "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or a hash of {\"pattern\": \"preference\"}." - }, - "notify-on-install": { - "type": "boolean", - "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true." - }, - "github-protocols": { - "type": "array", - "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].", - "items": { - "type": "string" - } - }, - "github-oauth": { - "type": "object", - "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"\"}.", - "additionalProperties": { - "type": "string" - } - }, - "gitlab-oauth": { - "type": "object", - "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"\"}.", - "additionalProperties": { - "type": "string" - } - }, - "gitlab-token": { - "type": "object", - "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"\"}.", - "additionalProperties": true - }, - "disable-tls": { - "type": "boolean", - "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini." - }, - "secure-http": { - "type": "boolean", - "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative." - }, - "cafile": { - "type": "string", - "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically." - }, - "capath": { - "type": "string", - "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory." - }, - "http-basic": { - "type": "object", - "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.", - "additionalProperties": { - "type": "object", - "required": ["username", "password"], - "properties": { - "username": { - "type": "string", - "description": "The username used for HTTP Basic authentication" - }, - "password": { - "type": "string", - "description": "The password used for HTTP Basic authentication" - } - } - } - }, - "store-auths": { - "type": ["string", "boolean"], - "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt." - }, - "platform": { - "type": "object", - "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.", - "additionalProperties": { - "type": "string" - } - }, - "vendor-dir": { - "type": "string", - "description": "The location where all packages are installed, defaults to \"vendor\"." - }, - "bin-dir": { - "type": "string", - "description": "The location where all binaries are linked, defaults to \"vendor/bin\"." - }, - "data-dir": { - "type": "string", - "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes." - }, - "cache-dir": { - "type": "string", - "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows." - }, - "cache-files-dir": { - "type": "string", - "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"." - }, - "cache-repo-dir": { - "type": "string", - "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"." - }, - "cache-vcs-dir": { - "type": "string", - "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"." - }, - "cache-ttl": { - "type": "integer", - "description": "The default cache time-to-live, defaults to 15552000 (6 months)." - }, - "cache-files-ttl": { - "type": "integer", - "description": "The cache time-to-live for files, defaults to the value of cache-ttl." - }, - "cache-files-maxsize": { - "type": ["string", "integer"], - "description": "The cache max size for the files cache, defaults to \"300MiB\"." - }, - "bin-compat": { - "enum": ["auto", "full"], - "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)." - }, - "discard-changes": { - "type": ["string", "boolean"], - "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"." - }, - "autoloader-suffix": { - "type": "string", - "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated." - }, - "optimize-autoloader": { - "type": "boolean", - "description": "Always optimize when dumping the autoloader." - }, - "prepend-autoloader": { - "type": "boolean", - "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true." - }, - "classmap-authoritative": { - "type": "boolean", - "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false." - }, - "apcu-autoloader": { - "type": "boolean", - "description": "If true, the Composer autoloader will check for APCu and use it to cache found/not-found classes when the extension is enabled, defaults to false." - }, - "github-domains": { - "type": "array", - "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].", - "items": { - "type": "string" - } - }, - "github-expose-hostname": { - "type": "boolean", - "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname." - }, - "gitlab-domains": { - "type": "array", - "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].", - "items": { - "type": "string" - } - }, - "archive-format": { - "type": "string", - "description": "The default archiving format when not provided on cli, defaults to \"tar\"." - }, - "archive-dir": { - "type": "string", - "description": "The default archive path when not provided on cli, defaults to \".\"." - }, - "htaccess-protect": { - "type": "boolean", - "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories." - }, - "sort-packages": { - "type": "boolean", - "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency." - } - } - }, - "extra": { - "type": ["object", "array"], - "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.", - "additionalProperties": true - }, - "autoload": { - "$ref": "#/definitions/autoload" - }, - "autoload-dev": { - "type": "object", - "description": "Description of additional autoload rules for development purpose (eg. a test suite).", - "properties": { - "psr-0": { - "type": "object", - "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.", - "additionalProperties": { - "type": ["string", "array"], - "items": { - "type": "string" - } - } - }, - "psr-4": { - "type": "object", - "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.", - "additionalProperties": { - "type": ["string", "array"], - "items": { - "type": "string" - } - } - }, - "classmap": { - "type": "array", - "description": "This is an array of directories that contain classes to be included in the class-map generation process." - }, - "files": { - "type": "array", - "description": "This is an array of files that are always required on every request." - } - } - }, - "archive": { - "type": ["object"], - "description": "Options for creating package archives for distribution.", - "properties": { - "exclude": { - "type": "array", - "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark." - } - } - }, - "repositories": { - "type": ["object", "array"], - "description": "A set of additional repositories where packages can be found.", - "additionalProperties": { - "oneOf": [ - { "$ref": "#/definitions/repository" }, - { "type": "boolean", "enum": [false] } - ] - }, - "items": { - "oneOf": [ - { "$ref": "#/definitions/repository" }, - { - "type": "object", - "additionalProperties": { "type": "boolean", "enum": [false] }, - "minProperties": 1, - "maxProperties": 1 - } - ] - } - }, - "minimum-stability": { - "type": ["string"], - "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.", - "pattern": "^dev|alpha|beta|rc|RC|stable$" - }, - "prefer-stable": { - "type": ["boolean"], - "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages." - }, - "bin": { - "type": ["string", "array"], - "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).", - "items": { - "type": "string" - } - }, - "include-path": { - "type": ["array"], - "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.", - "items": { - "type": "string" - } - }, - "scripts": { - "type": ["object"], - "description": "Script listeners that will be executed before/after some events.", - "properties": { - "pre-install-cmd": { - "type": ["array", "string"], - "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands." - }, - "post-install-cmd": { - "type": ["array", "string"], - "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands." - }, - "pre-update-cmd": { - "type": ["array", "string"], - "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands." - }, - "post-update-cmd": { - "type": ["array", "string"], - "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands." - }, - "pre-status-cmd": { - "type": ["array", "string"], - "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands." - }, - "post-status-cmd": { - "type": ["array", "string"], - "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands." - }, - "pre-package-install": { - "type": ["array", "string"], - "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands." - }, - "post-package-install": { - "type": ["array", "string"], - "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands." - }, - "pre-package-update": { - "type": ["array", "string"], - "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands." - }, - "post-package-update": { - "type": ["array", "string"], - "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands." - }, - "pre-package-uninstall": { - "type": ["array", "string"], - "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands." - }, - "post-package-uninstall": { - "type": ["array", "string"], - "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands." - }, - "pre-autoload-dump": { - "type": ["array", "string"], - "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands." - }, - "post-autoload-dump": { - "type": ["array", "string"], - "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands." - }, - "post-root-package-install": { - "type": ["array", "string"], - "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands." - }, - "post-create-project-cmd": { - "type": ["array", "string"], - "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands." - } - } - }, - "scripts-descriptions": { - "type": ["object"], - "description": "Descriptions for custom commands, shown in console help.", - "additionalProperties": { - "type": "string" - } - }, - "support": { - "type": "object", - "properties": { - "email": { - "type": "string", - "description": "Email address for support.", - "format": "email" - }, - "issues": { - "type": "string", - "description": "URL to the issue tracker.", - "format": "uri" - }, - "forum": { - "type": "string", - "description": "URL to the forum.", - "format": "uri" - }, - "wiki": { - "type": "string", - "description": "URL to the wiki.", - "format": "uri" - }, - "irc": { - "type": "string", - "description": "IRC channel for support, as irc://server/channel.", - "format": "uri" - }, - "source": { - "type": "string", - "description": "URL to browse or download the sources.", - "format": "uri" - }, - "docs": { - "type": "string", - "description": "URL to the documentation.", - "format": "uri" - }, - "rss": { - "type": "string", - "description": "URL to the RSS feed.", - "format": "uri" - } - } - }, - "non-feature-branches": { - "type": ["array"], - "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.", - "items": { - "type": "string" - } - }, - "abandoned": { - "type": ["boolean", "string"], - "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false." - }, - "_comment": { - "type": ["array", "string"], - "description": "A key to store comments in" - } - }, - "definitions": { - "authors": { - "type": "array", - "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.", - "items": { - "type": "object", - "additionalProperties": false, - "required": [ "name"], - "properties": { - "name": { - "type": "string", - "description": "Full name of the author." - }, - "email": { - "type": "string", - "description": "Email address of the author.", - "format": "email" - }, - "homepage": { - "type": "string", - "description": "Homepage URL for the author.", - "format": "uri" - }, - "role": { - "type": "string", - "description": "Author's role in the project." - } - } - } - }, - "autoload": { - "type": "object", - "description": "Description of how the package can be autoloaded.", - "properties": { - "psr-0": { - "type": "object", - "description": "This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.", - "additionalProperties": { - "type": ["string", "array"], - "items": { - "type": "string" - } - } - }, - "psr-4": { - "type": "object", - "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.", - "additionalProperties": { - "type": ["string", "array"], - "items": { - "type": "string" - } - } - }, - "classmap": { - "type": "array", - "description": "This is an array of directories that contain classes to be included in the class-map generation process." - }, - "files": { - "type": "array", - "description": "This is an array of files that are always required on every request." - }, - "exclude-from-classmap": { - "type": "array", - "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]" - } - } - }, - "repository": { - "type": "object", - "oneOf": [ - { "$ref": "#/definitions/composer-repository" }, - { "$ref": "#/definitions/vcs-repository" }, - { "$ref": "#/definitions/path-repository" }, - { "$ref": "#/definitions/artifact-repository" }, - { "$ref": "#/definitions/pear-repository" }, - { "$ref": "#/definitions/package-repository" } - ] - }, - "composer-repository": { - "type": "object", - "required": ["type", "url"], - "properties": { - "type": { "type": "string", "enum": ["composer"] }, - "url": { "type": "string" }, - "options": { - "type": "object", - "additionalProperties": true - }, - "allow_ssl_downgrade": { "type": "boolean" }, - "force-lazy-providers": { "type": "boolean" } - } - }, - "vcs-repository": { - "type": "object", - "required": ["type", "url"], - "properties": { - "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] }, - "url": { "type": "string" }, - "no-api": { "type": "boolean" }, - "secure-http": { "type": "boolean" }, - "svn-cache-credentials": { "type": "boolean" }, - "trunk-path": { "type": ["string", "boolean"] }, - "branches-path": { "type": ["string", "boolean"] }, - "tags-path": { "type": ["string", "boolean"] }, - "package-path": { "type": "string" }, - "depot": { "type": "string" }, - "branch": { "type": "string" }, - "unique_perforce_client_name": { "type": "string" }, - "p4user": { "type": "string" }, - "p4password": { "type": "string" } - } - }, - "path-repository": { - "type": "object", - "required": ["type", "url"], - "properties": { - "type": { "type": "string", "enum": ["path"] }, - "url": { "type": "string" }, - "options": { - "type": "object", - "properties": { - "symlink": { "type": ["boolean", "null"] } - }, - "additionalProperties": true - } - } - }, - "artifact-repository": { - "type": "object", - "required": ["type", "url"], - "properties": { - "type": { "type": "string", "enum": ["artifact"] }, - "url": { "type": "string" } - } - }, - "pear-repository": { - "type": "object", - "required": ["type", "url"], - "properties": { - "type": { "type": "string", "enum": ["pear"] }, - "url": { "type": "string" }, - "vendor-alias": { "type": "string" } - } - }, - "package-repository": { - "type": "object", - "required": ["type", "package"], - "properties": { - "type": { "type": "string", "enum": ["package"] }, - "package": { - "oneOf": [ - { "$ref": "#/definitions/inline-package" }, - { - "type": "array", - "items": { - "type": { "$ref": "#/definitions/inline-package" } - } - } - ] - } - } - }, - "inline-package": { - "required": ["name", "version"], - "properties": { - "name": { - "type": "string", - "description": "Package name, including 'vendor-name/' prefix." - }, - "type": { - "type": "string" - }, - "target-dir": { - "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.", - "type": "string" - }, - "description": { - "type": "string" - }, - "keywords": { - "type": "array", - "items": { - "type": "string" - } - }, - "homepage": { - "type": "string", - "format": "uri" - }, - "version": { - "type": "string" - }, - "time": { - "type": "string" - }, - "license": { - "type": [ - "string", - "array" - ] - }, - "authors": { - "$ref": "#/definitions/authors" - }, - "require": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "replace": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "conflict": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "provide": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "require-dev": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "suggest": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "extra": { - "type": ["object", "array"], - "additionalProperties": true - }, - "autoload": { - "$ref": "#/definitions/autoload" - }, - "archive": { - "type": ["object"], - "properties": { - "exclude": { - "type": "array" - } - } - }, - "bin": { - "type": ["string", "array"], - "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).", - "items": { - "type": "string" - } - }, - "include-path": { - "type": ["array"], - "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.", - "items": { - "type": "string" - } - }, - "source": { - "type": "object", - "required": ["type", "url", "reference"], - "properties": { - "type": { - "type": "string" - }, - "url": { - "type": "string" - }, - "reference": { - "type": "string" - }, - "mirrors": { - "type": "array" - } - } - }, - "dist": { - "type": "object", - "required": ["type", "url"], - "properties": { - "type": { - "type": "string" - }, - "url": { - "type": "string" - }, - "reference": { - "type": "string" - }, - "shasum": { - "type": "string" - }, - "mirrors": { - "type": "array" - } - } - } - }, - "additionalProperties": true - } - } -} diff --git a/test/Unit/NormalizePluginTest.php b/test/Unit/NormalizePluginTest.php index 28555ae8..97dc5d21 100644 --- a/test/Unit/NormalizePluginTest.php +++ b/test/Unit/NormalizePluginTest.php @@ -16,9 +16,9 @@ use Composer\Composer; use Composer\IO; use Composer\Plugin; +use Localheinz\Composer\Json\Normalizer; use Localheinz\Composer\Normalize\Command\NormalizeCommand; use Localheinz\Composer\Normalize\NormalizePlugin; -use Localheinz\Composer\Normalize\Normalizer; use Localheinz\Test\Util\Helper; use PHPUnit\Framework; diff --git a/test/Unit/Normalizer/AbstractNormalizerTestCase.php b/test/Unit/Normalizer/AbstractNormalizerTestCase.php deleted file mode 100644 index d4effa26..00000000 --- a/test/Unit/Normalizer/AbstractNormalizerTestCase.php +++ /dev/null @@ -1,85 +0,0 @@ -assertClassImplementsInterface(NormalizerInterface::class, $this->className()); - } - - /** - * @dataProvider providerJsonNotDecodingToObject - * - * @param string $encoded - */ - final public function testNormalizeDoesNotModifyWhenJsonDecodedIsNotAnObject(string $encoded): void - { - $json = Json::fromEncoded($encoded); - - $reflection = new \ReflectionClass($this->className()); - - /** @var NormalizerInterface $normalizer */ - $normalizer = $reflection->newInstanceWithoutConstructor(); - - $normalized = $normalizer->normalize($json); - - $this->assertSame($json->encoded(), $normalized->encoded()); - } - - public function providerJsonNotDecodingToObject(): \Generator - { - $faker = $this->faker(); - - $values = [ - 'array' => $faker->words, - 'bool-false' => false, - 'bool-true' => true, - 'float' => $faker->randomFloat(), - 'int' => $faker->randomNumber(), - 'null' => null, - 'string' => $faker->sentence, - ]; - - foreach ($values as $key => $value) { - yield $key => [ - \json_encode($value), - ]; - } - } - - final protected function className(): string - { - return \preg_replace( - '/Test$/', - '', - \str_replace( - 'Localheinz\\Composer\\Normalize\\Test\\Unit\\', - 'Localheinz\\Composer\\Normalize\\', - static::class - ) - ); - } -} diff --git a/test/Unit/Normalizer/BinNormalizerTest.php b/test/Unit/Normalizer/BinNormalizerTest.php deleted file mode 100644 index 62cd12c8..00000000 --- a/test/Unit/Normalizer/BinNormalizerTest.php +++ /dev/null @@ -1,103 +0,0 @@ -normalize($json); - - $this->assertSame($json->encoded(), $normalized->encoded()); - } - - public function testNormalizeDoesNotModifyBinIfPropertyExistsAsString(): void - { - $json = Json::fromEncoded( -<<<'JSON' -{ - "bin": "foo.php", - "foo": { - "qux": "quux", - "bar": "baz" - } -} -JSON - ); - - $normalizer = new BinNormalizer(); - - $normalized = $normalizer->normalize($json); - - $this->assertSame($json->encoded(), $normalized->encoded()); - } - - public function testNormalizeSortsBinIfPropertyExistsAsArray(): void - { - $json = Json::fromEncoded( -<<<'JSON' -{ - "bin": [ - "script.php", - "another-script.php" - ], - "foo": { - "qux": "quux", - "bar": "baz" - } -} -JSON - ); - - $expected = Json::fromEncoded( -<<<'JSON' -{ - "bin": [ - "another-script.php", - "script.php" - ], - "foo": { - "qux": "quux", - "bar": "baz" - } -} -JSON - ); - - $normalizer = new BinNormalizer(); - - $normalized = $normalizer->normalize($json); - - $this->assertSame(\json_encode(\json_decode($expected->encoded())), $normalized->encoded()); - } -} diff --git a/test/Unit/Normalizer/ComposerJsonNormalizerTest.php b/test/Unit/Normalizer/ComposerJsonNormalizerTest.php deleted file mode 100644 index e0c36b08..00000000 --- a/test/Unit/Normalizer/ComposerJsonNormalizerTest.php +++ /dev/null @@ -1,286 +0,0 @@ -assertComposesNormalizer(ChainNormalizer::class, $normalizer); - - $chainNormalizer = $this->composedNormalizer($normalizer); - - $normalizerClassNames = [ - SchemaNormalizer::class, - BinNormalizer::class, - ConfigHashNormalizer::class, - PackageHashNormalizer::class, - VersionConstraintNormalizer::class, - ]; - - $this->assertComposesNormalizers($normalizerClassNames, $chainNormalizer); - - $chainedNormalizers = $this->composedNormalizers($chainNormalizer); - - $schemaNormalizer = \array_shift($chainedNormalizers); - - $this->assertInstanceOf(SchemaNormalizer::class, $schemaNormalizer); - $this->assertAttributeSame('https://getcomposer.org/schema.json', 'schemaUri', $schemaNormalizer); - } - - public function testNormalizeNormalizes(): void - { - $json = Json::fromEncoded( -<<<'JSON' -{ - "name": "foo/bar", - "description": "In der Fantasie geht alles", - "type": "library", - "license": "MIT", - "keywords": [ - "null", - "helmut", - "körschgen" - ], - "authors": [ - { - "role": "Lieutenant", - "homepage": "http://example.org", - "name": "Helmut Körschgen" - } - ], - "config": { - "sort-packages": true, - "preferred-install": "dist" - }, - "repositories": [ - { - "url": "git@github.com:localheinz/test-util", - "type": "vcs" - } - ], - "require": { - "localheinz/json-printer": "^1.0.0", - "php": "^7.0" - }, - "require-dev": { - "localheinz/test-util": "0.6.1", - "phpunit/phpunit": "^6.5.5", - "localheinz/php-cs-fixer-config": "~1.0.0|~1.11.0" - }, - "autoload": { - "psr-4": { - "": "/foo", - "Helmut\\Foo\\Bar\\": "src/" - } - }, - "scripts": { - "foo": "foo.sh", - "bar": "bar.sh", - "post-install-cmd": "@foo", - "pre-install-cmd": [ - "@foo", - "@bar" - ] - }, - "scripts-descriptions": { - "foo": "Executes foo.sh", - "bar": "Executes bar.sh", - "post-install-cmd": "Runs foo", - "pre-install-cmd": "Runs foo and bar" - }, - "autoload-dev": { - "psr-4": { - "Helmut\\Foo\\Bar\\Test\\": "test/" - } - }, - "bin": [ - "scripts/null-null.php", - "hasenbein.php" - ] -} -JSON - ); - - $expected = Json::fromEncoded( -<<<'JSON' -{ - "name": "foo/bar", - "type": "library", - "description": "In der Fantasie geht alles", - "keywords": [ - "null", - "helmut", - "körschgen" - ], - "license": "MIT", - "authors": [ - { - "name": "Helmut Körschgen", - "homepage": "http://example.org", - "role": "Lieutenant" - } - ], - "require": { - "php": "^7.0", - "localheinz/json-printer": "^1.0.0" - }, - "require-dev": { - "localheinz/php-cs-fixer-config": "~1.0.0 || ~1.11.0", - "localheinz/test-util": "0.6.1", - "phpunit/phpunit": "^6.5.5" - }, - "config": { - "preferred-install": "dist", - "sort-packages": true - }, - "autoload": { - "psr-4": { - "": "/foo", - "Helmut\\Foo\\Bar\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Helmut\\Foo\\Bar\\Test\\": "test/" - } - }, - "repositories": [ - { - "type": "vcs", - "url": "git@github.com:localheinz/test-util" - } - ], - "bin": [ - "hasenbein.php", - "scripts/null-null.php" - ], - "scripts": { - "pre-install-cmd": [ - "@foo", - "@bar" - ], - "post-install-cmd": "@foo", - "bar": "bar.sh", - "foo": "foo.sh" - }, - "scripts-descriptions": { - "bar": "Executes bar.sh", - "foo": "Executes foo.sh", - "post-install-cmd": "Runs foo", - "pre-install-cmd": "Runs foo and bar" - } -} -JSON - ); - - $normalizer = new ComposerJsonNormalizer(\sprintf( - 'file://%s', - \realpath(__DIR__ . '/../../Fixture/composer-schema.json') - )); - - $normalized = $normalizer->normalize($json); - - $this->assertSame(\json_encode(\json_decode($expected->encoded())), $normalized->encoded()); - } - - private function assertComposesNormalizer(string $className, NormalizerInterface $normalizer): void - { - $this->assertClassExists($className); - $this->assertClassImplementsInterface(NormalizerInterface::class, $className); - - $attributeName = 'normalizer'; - - $this->assertObjectHasAttribute($attributeName, $normalizer, \sprintf( - 'Failed asserting that a normalizer has an attribute "%s".', - $attributeName - )); - - $composedNormalizer = $this->composedNormalizer($normalizer); - - $this->assertInstanceOf($className, $composedNormalizer, \sprintf( - 'Failed asserting that a normalizer composes a normalizer of type "%s".', - $className - )); - } - - private function assertComposesNormalizers(array $classNames, NormalizerInterface $normalizer): void - { - foreach ($classNames as $className) { - $this->assertClassExists($className); - $this->assertClassImplementsInterface(NormalizerInterface::class, $className); - } - - $attributeName = 'normalizers'; - - $this->assertObjectHasAttribute($attributeName, $normalizer, \sprintf( - 'Failed asserting that a normalizer has an attribute "%s".', - $attributeName - )); - - $composedNormalizers = $this->composedNormalizers($normalizer); - - $composedNormalizerClassNames = \array_map(function ($normalizer) { - return \get_class($normalizer); - }, $composedNormalizers); - - $this->assertSame( - $classNames, - $composedNormalizerClassNames, - 'Failed asserting that a normalizer composes normalizers as expected.' - ); - } - - private function composedNormalizer(NormalizerInterface $normalizer) - { - return $this->attributeValue( - 'normalizer', - $normalizer - ); - } - - private function composedNormalizers(NormalizerInterface $normalizer) - { - return $this->attributeValue( - 'normalizers', - $normalizer - ); - } - - private function attributeValue(string $name, NormalizerInterface $normalizer) - { - $reflection = new \ReflectionObject($normalizer); - - $property = $reflection->getProperty($name); - - $property->setAccessible(true); - - return $property->getValue($normalizer); - } -} diff --git a/test/Unit/Normalizer/ConfigHashNormalizerTest.php b/test/Unit/Normalizer/ConfigHashNormalizerTest.php deleted file mode 100644 index c9db03a8..00000000 --- a/test/Unit/Normalizer/ConfigHashNormalizerTest.php +++ /dev/null @@ -1,127 +0,0 @@ -normalize($json); - - $this->assertSame($json->encoded(), $normalized->encoded()); - } - - /** - * @dataProvider providerProperty - * - * @param string $property - */ - public function testNormalizeIgnoresEmptyConfigHash(string $property): void - { - $json = Json::fromEncoded( -<<normalize($json); - - $this->assertSame($json->encoded(), $normalized->encoded()); - } - - /** - * @dataProvider providerProperty - * - * @param string $property - */ - public function testNormalizeSortsConfigHashIfPropertyExists(string $property): void - { - $json = Json::fromEncoded( -<<normalize($json); - - $this->assertSame(\json_encode(\json_decode($expected->encoded())), $normalized->encoded()); - } - - public function providerProperty(): \Generator - { - foreach ($this->properties() as $value) { - yield $value => [ - $value, - ]; - } - } - - private function properties(): array - { - return [ - 'config', - 'extra', - 'scripts-descriptions', - ]; - } -} diff --git a/test/Unit/Normalizer/PackageHashNormalizerTest.php b/test/Unit/Normalizer/PackageHashNormalizerTest.php deleted file mode 100644 index 13f45c7b..00000000 --- a/test/Unit/Normalizer/PackageHashNormalizerTest.php +++ /dev/null @@ -1,138 +0,0 @@ -normalize($json); - - $this->assertSame($json->encoded(), $normalized->encoded()); - } - - /** - * @dataProvider providerProperty - * - * @param string $property - */ - public function testNormalizeIgnoresEmptyPackageHash(string $property): void - { - $json = Json::fromEncoded( -<<normalize($json); - - $this->assertSame(\json_encode(\json_decode($json->encoded())), $normalized->encoded()); - } - - /** - * @dataProvider providerProperty - * - * @param string $property - */ - public function testNormalizeSortsPackageHashIfPropertyExists(string $property): void - { - $json = Json::fromEncoded( -<<normalize($json); - - $this->assertSame(\json_encode(\json_decode($expected->encoded())), $normalized->encoded()); - } - - public function providerProperty(): \Generator - { - foreach ($this->propertiesWhereKeysOfHashArePackages() as $value) { - yield $value => [ - $value, - ]; - } - } - - private function propertiesWhereKeysOfHashArePackages(): array - { - return [ - 'conflict', - 'provide', - 'replace', - 'require', - 'require-dev', - 'suggest', - ]; - } -} diff --git a/test/Unit/Normalizer/VersionConstraintNormalizerTest.php b/test/Unit/Normalizer/VersionConstraintNormalizerTest.php deleted file mode 100644 index 4907485f..00000000 --- a/test/Unit/Normalizer/VersionConstraintNormalizerTest.php +++ /dev/null @@ -1,264 +0,0 @@ -normalize($json); - - $this->assertSame($json->encoded(), $normalized->encoded()); - } - - public function providerVersionConstraint(): \Generator - { - foreach (\array_keys($this->versionConstraints()) as $versionConstraint) { - yield [ - $versionConstraint, - ]; - } - } - - /** - * @dataProvider providerProperty - * - * @param string $property - */ - public function testNormalizeIgnoresEmptyPackageHash(string $property): void - { - $json = Json::fromEncoded( -<<normalize($json); - - $this->assertSame(\json_encode(\json_decode($json->encoded())), $normalized->encoded()); - } - - public function providerProperty(): \Generator - { - $properties = $this->propertiesWhereValuesOfHashAreVersionConstraints(); - - foreach ($properties as $property) { - yield [ - $property, - ]; - } - } - - /** - * @dataProvider providerPropertyAndVersionConstraint - * - * @param string $property - * @param string $versionConstraint - * @param string $normalizedVersionConstraint - */ - public function testNormalizeNormalizesVersionConstraints(string $property, string $versionConstraint, string $normalizedVersionConstraint): void - { - $json = Json::fromEncoded( -<<normalize($json); - - $this->assertJsonStringEqualsJsonString($expected->encoded(), $normalized->encoded()); - } - - public function providerPropertyAndVersionConstraint(): \Generator - { - $properties = $this->propertiesWhereValuesOfHashAreVersionConstraints(); - $versionConstraints = $this->versionConstraints(); - - foreach ($properties as $property) { - foreach ($versionConstraints as $versionConstraint => $normalizedVersionConstraint) { - yield [ - $property, - $versionConstraint, - $normalizedVersionConstraint, - ]; - } - } - } - - /** - * @dataProvider providerPropertyAndUntrimmedVersionConstraint - * - * @param string $property - * @param string $versionConstraint - * @param string $trimmedVersionConstraint - */ - public function testNormalizeNormalizesTrimsVersionConstraints(string $property, string $versionConstraint, string $trimmedVersionConstraint): void - { - $json = Json::fromEncoded( -<<normalize($json); - - $this->assertJsonStringEqualsJsonString($expected->encoded(), $normalized->encoded()); - } - - public function providerPropertyAndUntrimmedVersionConstraint(): \Generator - { - $spaces = [ - '', - ' ', - ]; - - $properties = $this->propertiesWhereValuesOfHashAreVersionConstraints(); - $versionConstraints = \array_unique(\array_values($this->versionConstraints())); - - foreach ($properties as $property) { - foreach ($versionConstraints as $trimmedVersionConstraint) { - foreach ($spaces as $prefix) { - foreach ($spaces as $suffix) { - $untrimmedVersionConstraint = $prefix . $trimmedVersionConstraint . $suffix; - - if ($trimmedVersionConstraint === $untrimmedVersionConstraint) { - continue; - } - - yield [ - $property, - $untrimmedVersionConstraint, - $trimmedVersionConstraint, - ]; - } - } - } - } - } - - private function propertiesWhereValuesOfHashAreVersionConstraints(): array - { - return [ - 'conflict', - 'provide', - 'replace', - 'require', - 'require-dev', - ]; - } - - /** - * @see https://getcomposer.org/doc/articles/versions.md - * - * @return array - */ - private function versionConstraints(): array - { - return [ - /** - * @see https://getcomposer.org/doc/articles/versions.md#branches - */ - 'dev-master' => 'dev-master', - 'dev-my-feature' => 'dev-my-feature', - 'dev-master#bf2eeff' => 'dev-master#bf2eeff', - /** - * @see https://getcomposer.org/doc/articles/versions.md#exact-version-constraint - */ - '1.0.2' => '1.0.2', - /** - * @see https://getcomposer.org/doc/articles/versions.md#version-range - */ - '>=1.0' => '>=1.0', - '>=1.0 <2.0' => '>=1.0 <2.0', - '>=1.0,<2.0' => '>=1.0,<2.0', - '>=1.0 <2.0' => '>=1.0 <2.0', - '>=1.0 , <2.0' => '>=1.0,<2.0', - '>=1.0 <1.1 || >=1.2' => '>=1.0 <1.1 || >=1.2', - '>=1.0,<1.1 || >=1.2' => '>=1.0,<1.1 || >=1.2', - '>=1.0 <1.1||>=1.2' => '>=1.0 <1.1 || >=1.2', - /** - * @see https://getcomposer.org/doc/articles/versions.md#hyphenated-version-range- - */ - '1.0 - 2.0' => '1.0 - 2.0', - '1.0 - 2.0' => '1.0 - 2.0', - /** - * @see https://getcomposer.org/doc/articles/versions.md#next-significant-release-operators - */ - '~1.2' => '~1.2', - /** - * @see https://getcomposer.org/doc/articles/versions.md#caret-version-range- - */ - '^1.2.3' => '^1.2.3', - ]; - } -}