Updated Rector to commit d2abf114ed5388698cc580a295899110570463ce

d2abf114ed [DX] remove composer-json-manipulator (#2871)
This commit is contained in:
Tomas Votruba 2022-08-31 10:13:06 +00:00
parent afd984fc4e
commit da925822fa
24 changed files with 52 additions and 1525 deletions

View File

@ -17,12 +17,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'b8c70125cda3a0fbdff216dfccaf065d8fe1aa2b';
public const PACKAGE_VERSION = 'd2abf114ed5388698cc580a295899110570463ce';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2022-08-31 09:27:23';
public const RELEASE_DATE = '2022-08-31 12:07:39';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit3595c7d5f829a41f3682c309e93459b6::getLoader();
return ComposerAutoloaderInit56fc294f4deb3a2d73b7defad0e9de46::getLoader();

View File

@ -1024,16 +1024,6 @@ return array(
'RectorPrefix202208\\Symplify\\AutowireArrayParameter\\Exception\\DependencyInjection\\DefinitionForTypeNotFoundException' => $vendorDir . '/symplify/autowire-array-parameter/src/Exception/DependencyInjection/DefinitionForTypeNotFoundException.php',
'RectorPrefix202208\\Symplify\\AutowireArrayParameter\\Skipper\\ParameterSkipper' => $vendorDir . '/symplify/autowire-array-parameter/src/Skipper/ParameterSkipper.php',
'RectorPrefix202208\\Symplify\\AutowireArrayParameter\\TypeResolver\\ParameterTypeResolver' => $vendorDir . '/symplify/autowire-array-parameter/src/TypeResolver/ParameterTypeResolver.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\ComposerJsonFactory' => $vendorDir . '/symplify/composer-json-manipulator/src/ComposerJsonFactory.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\FileSystem\\JsonFileManager' => $vendorDir . '/symplify/composer-json-manipulator/src/FileSystem/JsonFileManager.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\Json\\JsonCleaner' => $vendorDir . '/symplify/composer-json-manipulator/src/Json/JsonCleaner.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\Json\\JsonInliner' => $vendorDir . '/symplify/composer-json-manipulator/src/Json/JsonInliner.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\Printer\\ComposerJsonPrinter' => $vendorDir . '/symplify/composer-json-manipulator/src/Printer/ComposerJsonPrinter.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\Sorter\\ComposerPackageSorter' => $vendorDir . '/symplify/composer-json-manipulator/src/Sorter/ComposerPackageSorter.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\ValueObject\\ComposerJson' => $vendorDir . '/symplify/composer-json-manipulator/src/ValueObject/ComposerJson.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\ValueObject\\ComposerJsonManipulatorConfig' => $vendorDir . '/symplify/composer-json-manipulator/src/ValueObject/ComposerJsonManipulatorConfig.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\ValueObject\\ComposerJsonSection' => $vendorDir . '/symplify/composer-json-manipulator/src/ValueObject/ComposerJsonSection.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\ValueObject\\Option' => $vendorDir . '/symplify/composer-json-manipulator/src/ValueObject/Option.php',
'RectorPrefix202208\\Symplify\\EasyParallel\\CommandLine\\WorkerCommandLineFactory' => $vendorDir . '/symplify/easy-parallel/src/CommandLine/WorkerCommandLineFactory.php',
'RectorPrefix202208\\Symplify\\EasyParallel\\Contract\\SerializableInterface' => $vendorDir . '/symplify/easy-parallel/src/Contract/SerializableInterface.php',
'RectorPrefix202208\\Symplify\\EasyParallel\\CpuCoreCountProvider' => $vendorDir . '/symplify/easy-parallel/src/CpuCoreCountProvider.php',

View File

@ -25,7 +25,6 @@ return array(
'RectorPrefix202208\\Symplify\\Skipper\\' => array($vendorDir . '/symplify/skipper/src'),
'RectorPrefix202208\\Symplify\\PackageBuilder\\' => array($vendorDir . '/symplify/package-builder/src'),
'RectorPrefix202208\\Symplify\\EasyParallel\\' => array($vendorDir . '/symplify/easy-parallel/src'),
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\' => array($vendorDir . '/symplify/composer-json-manipulator/src'),
'RectorPrefix202208\\Symplify\\AutowireArrayParameter\\' => array($vendorDir . '/symplify/autowire-array-parameter/src'),
'RectorPrefix202208\\Symfony\\Contracts\\' => array($vendorDir . '/symfony/contracts'),
'RectorPrefix202208\\Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit3595c7d5f829a41f3682c309e93459b6
class ComposerAutoloaderInit56fc294f4deb3a2d73b7defad0e9de46
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit3595c7d5f829a41f3682c309e93459b6
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit3595c7d5f829a41f3682c309e93459b6', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit56fc294f4deb3a2d73b7defad0e9de46', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit3595c7d5f829a41f3682c309e93459b6', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit56fc294f4deb3a2d73b7defad0e9de46', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit3595c7d5f829a41f3682c309e93459b6::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit56fc294f4deb3a2d73b7defad0e9de46::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit3595c7d5f829a41f3682c309e93459b6::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit56fc294f4deb3a2d73b7defad0e9de46::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire3595c7d5f829a41f3682c309e93459b6($fileIdentifier, $file);
composerRequire56fc294f4deb3a2d73b7defad0e9de46($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit3595c7d5f829a41f3682c309e93459b6
* @param string $file
* @return void
*/
function composerRequire3595c7d5f829a41f3682c309e93459b6($fileIdentifier, $file)
function composerRequire56fc294f4deb3a2d73b7defad0e9de46($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit3595c7d5f829a41f3682c309e93459b6
class ComposerStaticInit56fc294f4deb3a2d73b7defad0e9de46
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -42,7 +42,6 @@ class ComposerStaticInit3595c7d5f829a41f3682c309e93459b6
'RectorPrefix202208\\Symplify\\Skipper\\' => 36,
'RectorPrefix202208\\Symplify\\PackageBuilder\\' => 43,
'RectorPrefix202208\\Symplify\\EasyParallel\\' => 41,
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\' => 52,
'RectorPrefix202208\\Symplify\\AutowireArrayParameter\\' => 51,
'RectorPrefix202208\\Symfony\\Contracts\\' => 37,
'RectorPrefix202208\\Symfony\\Component\\String\\' => 44,
@ -159,10 +158,6 @@ class ComposerStaticInit3595c7d5f829a41f3682c309e93459b6
array (
0 => __DIR__ . '/..' . '/symplify/easy-parallel/src',
),
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\' =>
array (
0 => __DIR__ . '/..' . '/symplify/composer-json-manipulator/src',
),
'RectorPrefix202208\\Symplify\\AutowireArrayParameter\\' =>
array (
0 => __DIR__ . '/..' . '/symplify/autowire-array-parameter/src',
@ -1304,16 +1299,6 @@ class ComposerStaticInit3595c7d5f829a41f3682c309e93459b6
'RectorPrefix202208\\Symplify\\AutowireArrayParameter\\Exception\\DependencyInjection\\DefinitionForTypeNotFoundException' => __DIR__ . '/..' . '/symplify/autowire-array-parameter/src/Exception/DependencyInjection/DefinitionForTypeNotFoundException.php',
'RectorPrefix202208\\Symplify\\AutowireArrayParameter\\Skipper\\ParameterSkipper' => __DIR__ . '/..' . '/symplify/autowire-array-parameter/src/Skipper/ParameterSkipper.php',
'RectorPrefix202208\\Symplify\\AutowireArrayParameter\\TypeResolver\\ParameterTypeResolver' => __DIR__ . '/..' . '/symplify/autowire-array-parameter/src/TypeResolver/ParameterTypeResolver.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\ComposerJsonFactory' => __DIR__ . '/..' . '/symplify/composer-json-manipulator/src/ComposerJsonFactory.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\FileSystem\\JsonFileManager' => __DIR__ . '/..' . '/symplify/composer-json-manipulator/src/FileSystem/JsonFileManager.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\Json\\JsonCleaner' => __DIR__ . '/..' . '/symplify/composer-json-manipulator/src/Json/JsonCleaner.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\Json\\JsonInliner' => __DIR__ . '/..' . '/symplify/composer-json-manipulator/src/Json/JsonInliner.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\Printer\\ComposerJsonPrinter' => __DIR__ . '/..' . '/symplify/composer-json-manipulator/src/Printer/ComposerJsonPrinter.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\Sorter\\ComposerPackageSorter' => __DIR__ . '/..' . '/symplify/composer-json-manipulator/src/Sorter/ComposerPackageSorter.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\ValueObject\\ComposerJson' => __DIR__ . '/..' . '/symplify/composer-json-manipulator/src/ValueObject/ComposerJson.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\ValueObject\\ComposerJsonManipulatorConfig' => __DIR__ . '/..' . '/symplify/composer-json-manipulator/src/ValueObject/ComposerJsonManipulatorConfig.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\ValueObject\\ComposerJsonSection' => __DIR__ . '/..' . '/symplify/composer-json-manipulator/src/ValueObject/ComposerJsonSection.php',
'RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\ValueObject\\Option' => __DIR__ . '/..' . '/symplify/composer-json-manipulator/src/ValueObject/Option.php',
'RectorPrefix202208\\Symplify\\EasyParallel\\CommandLine\\WorkerCommandLineFactory' => __DIR__ . '/..' . '/symplify/easy-parallel/src/CommandLine/WorkerCommandLineFactory.php',
'RectorPrefix202208\\Symplify\\EasyParallel\\Contract\\SerializableInterface' => __DIR__ . '/..' . '/symplify/easy-parallel/src/Contract/SerializableInterface.php',
'RectorPrefix202208\\Symplify\\EasyParallel\\CpuCoreCountProvider' => __DIR__ . '/..' . '/symplify/easy-parallel/src/CpuCoreCountProvider.php',
@ -3161,9 +3146,9 @@ class ComposerStaticInit3595c7d5f829a41f3682c309e93459b6
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit3595c7d5f829a41f3682c309e93459b6::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit3595c7d5f829a41f3682c309e93459b6::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit3595c7d5f829a41f3682c309e93459b6::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit56fc294f4deb3a2d73b7defad0e9de46::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit56fc294f4deb3a2d73b7defad0e9de46::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit56fc294f4deb3a2d73b7defad0e9de46::$classMap;
}, null, ClassLoader::class);
}

View File

@ -3108,24 +3108,24 @@
},
{
"name": "symplify\/autowire-array-parameter",
"version": "11.1.6",
"version_normalized": "11.1.6.0",
"version": "dev-main",
"version_normalized": "dev-main",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/autowire-array-parameter.git",
"reference": "4bd09786fd6c8cad3fcf1824fc1f5f387d30e4b0"
"reference": "c5865d56cb3976862815c6aa49c7ba7ff16c7509"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/autowire-array-parameter\/zipball\/4bd09786fd6c8cad3fcf1824fc1f5f387d30e4b0",
"reference": "4bd09786fd6c8cad3fcf1824fc1f5f387d30e4b0",
"url": "https:\/\/api.github.com\/repos\/symplify\/autowire-array-parameter\/zipball\/c5865d56cb3976862815c6aa49c7ba7ff16c7509",
"reference": "c5865d56cb3976862815c6aa49c7ba7ff16c7509",
"shasum": ""
},
"require": {
"nette\/utils": "^3.2",
"php": ">=8.0",
"symfony\/dependency-injection": "^6.0",
"symplify\/package-builder": "^11.1.6"
"symplify\/package-builder": "^11.2"
},
"conflict": {
"symplify\/coding-standard": "<11.1.6",
@ -3150,7 +3150,8 @@
"require-dev": {
"phpunit\/phpunit": "^9.5.23"
},
"time": "2022-08-31T08:17:59+00:00",
"time": "2022-08-31T08:19:28+00:00",
"default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
@ -3169,7 +3170,7 @@
],
"description": "Autowire array parameters for your Symfony applications",
"support": {
"source": "https:\/\/github.com\/symplify\/autowire-array-parameter\/tree\/11.1.6"
"source": "https:\/\/github.com\/symplify\/autowire-array-parameter\/tree\/main"
},
"funding": [
{
@ -3183,86 +3184,6 @@
],
"install-path": "..\/symplify\/autowire-array-parameter"
},
{
"name": "symplify\/composer-json-manipulator",
"version": "11.1.6",
"version_normalized": "11.1.6.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/composer-json-manipulator.git",
"reference": "02fc1901f2bf8d62810174f9bc16143f1f5f72f0"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/composer-json-manipulator\/zipball\/02fc1901f2bf8d62810174f9bc16143f1f5f72f0",
"reference": "02fc1901f2bf8d62810174f9bc16143f1f5f72f0",
"shasum": ""
},
"require": {
"nette\/utils": "^3.2",
"php": ">=8.0",
"symfony\/config": "^6.0",
"symfony\/dependency-injection": "^6.0",
"symfony\/filesystem": "^6.0",
"symplify\/package-builder": "^11.1.6",
"symplify\/smart-file-system": "^11.1.6",
"symplify\/symplify-kernel": "^11.1.6"
},
"conflict": {
"symplify\/autowire-array-parameter": "<11.1.6",
"symplify\/coding-standard": "<11.1.6",
"symplify\/config-transformer": "<11.1.6",
"symplify\/easy-ci": "<11.1.6",
"symplify\/easy-coding-standard": "<11.1.6",
"symplify\/easy-parallel": "<11.1.6",
"symplify\/easy-testing": "<11.1.6",
"symplify\/monorepo-builder": "<11.1.6",
"symplify\/php-config-printer": "<11.1.6",
"symplify\/phpstan-extensions": "<11.1.6",
"symplify\/phpstan-rules": "<11.1.6",
"symplify\/rule-doc-generator": "<11.1.6",
"symplify\/rule-doc-generator-contracts": "<11.1.6",
"symplify\/skipper": "<11.1.6",
"symplify\/symfony-static-dumper": "<11.1.6",
"symplify\/symplify-kernel": "<9.4.70",
"symplify\/vendor-patches": "<11.1.6"
},
"require-dev": {
"phpunit\/phpunit": "^9.5.23"
},
"time": "2022-08-31T08:17:52+00:00",
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-main": "11.2-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\": "src"
}
},
"notification-url": "https:\/\/packagist.org\/downloads\/",
"license": [
"MIT"
],
"description": "Package to load, merge and save composer.json file(s)",
"support": {
"source": "https:\/\/github.com\/symplify\/composer-json-manipulator\/tree\/11.1.6"
},
"funding": [
{
"url": "https:\/\/www.paypal.me\/rectorphp",
"type": "custom"
},
{
"url": "https:\/\/github.com\/tomasvotruba",
"type": "github"
}
],
"install-path": "..\/symplify\/composer-json-manipulator"
},
{
"name": "symplify\/easy-parallel",
"version": "11.1.6",
@ -3336,17 +3257,17 @@
},
{
"name": "symplify\/package-builder",
"version": "11.1.6",
"version_normalized": "11.1.6.0",
"version": "dev-main",
"version_normalized": "dev-main",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/package-builder.git",
"reference": "575378dc57d0e1b7c3cbd306bfc4386505717119"
"reference": "87916f237343c7adca511e4b8dbb5fd928f0b8e5"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/package-builder\/zipball\/575378dc57d0e1b7c3cbd306bfc4386505717119",
"reference": "575378dc57d0e1b7c3cbd306bfc4386505717119",
"url": "https:\/\/api.github.com\/repos\/symplify\/package-builder\/zipball\/87916f237343c7adca511e4b8dbb5fd928f0b8e5",
"reference": "87916f237343c7adca511e4b8dbb5fd928f0b8e5",
"shasum": ""
},
"require": {
@ -3357,7 +3278,7 @@
"symfony\/console": "^6.0",
"symfony\/dependency-injection": "^6.0",
"symfony\/finder": "^6.0",
"symplify\/symplify-kernel": "^11.1.6"
"symplify\/symplify-kernel": "^11.2"
},
"conflict": {
"symplify\/autowire-array-parameter": "<11.1.6",
@ -3382,7 +3303,8 @@
"require-dev": {
"phpunit\/phpunit": "^9.5.23"
},
"time": "2022-08-31T08:18:04+00:00",
"time": "2022-08-31T08:19:28+00:00",
"default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
@ -3401,7 +3323,7 @@
],
"description": "Dependency Injection, Console and Kernel toolkit for Symplify packages.",
"support": {
"source": "https:\/\/github.com\/symplify\/package-builder\/tree\/11.1.6"
"source": "https:\/\/github.com\/symplify\/package-builder\/tree\/main"
},
"funding": [
{
@ -3570,8 +3492,8 @@
},
{
"name": "symplify\/smart-file-system",
"version": "11.1.6",
"version_normalized": "11.1.6.0",
"version": "dev-main",
"version_normalized": "dev-main",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/smart-file-system.git",
@ -3615,6 +3537,7 @@
"phpunit\/phpunit": "^9.5.23"
},
"time": "2022-08-31T08:16:44+00:00",
"default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
@ -3649,27 +3572,26 @@
},
{
"name": "symplify\/symplify-kernel",
"version": "11.1.6",
"version_normalized": "11.1.6.0",
"version": "dev-main",
"version_normalized": "dev-main",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/symplify-kernel.git",
"reference": "d9d084920b6dd52d8ec2022b3a3b8ced3d7d9d00"
"reference": "f2946844f34c785f6c4920edc50bcfdd07862562"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/symplify-kernel\/zipball\/d9d084920b6dd52d8ec2022b3a3b8ced3d7d9d00",
"reference": "d9d084920b6dd52d8ec2022b3a3b8ced3d7d9d00",
"url": "https:\/\/api.github.com\/repos\/symplify\/symplify-kernel\/zipball\/f2946844f34c785f6c4920edc50bcfdd07862562",
"reference": "f2946844f34c785f6c4920edc50bcfdd07862562",
"shasum": ""
},
"require": {
"php": ">=8.0",
"symfony\/console": "^6.0",
"symfony\/dependency-injection": "^6.0",
"symplify\/autowire-array-parameter": "^11.1.6",
"symplify\/composer-json-manipulator": "^11.1.6",
"symplify\/package-builder": "^11.1.6",
"symplify\/smart-file-system": "^11.1.6",
"symplify\/autowire-array-parameter": "^11.2",
"symplify\/package-builder": "^11.2",
"symplify\/smart-file-system": "^11.2",
"webmozart\/assert": "^1.10"
},
"conflict": {
@ -3692,7 +3614,8 @@
"require-dev": {
"phpunit\/phpunit": "^9.5.23"
},
"time": "2022-08-31T08:18:16+00:00",
"time": "2022-08-31T09:28:54+00:00",
"default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
@ -3711,7 +3634,7 @@
],
"description": "Internal Kernel for Symplify packages",
"support": {
"source": "https:\/\/github.com\/symplify\/symplify-kernel\/tree\/11.1.6"
"source": "https:\/\/github.com\/symplify\/symplify-kernel\/tree\/main"
},
"install-path": "..\/symplify\/symplify-kernel"
},

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@
"php": ">=8.0",
"nette\/utils": "^3.2",
"symfony\/dependency-injection": "^6.0",
"symplify\/package-builder": "^11.1.6"
"symplify\/package-builder": "^11.2"
},
"require-dev": {
"phpunit\/phpunit": "^9.5.23"

View File

@ -1,25 +0,0 @@
The MIT License
---------------
Copyright (c) 2020 Tomas Votruba (https://tomasvotruba.com)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,55 +0,0 @@
{
"name": "symplify\/composer-json-manipulator",
"description": "Package to load, merge and save composer.json file(s)",
"license": "MIT",
"type": "symfony-bundle",
"require": {
"php": ">=8.0",
"nette\/utils": "^3.2",
"symfony\/config": "^6.0",
"symfony\/dependency-injection": "^6.0",
"symfony\/filesystem": "^6.0",
"symplify\/package-builder": "^11.1.6",
"symplify\/symplify-kernel": "^11.1.6",
"symplify\/smart-file-system": "^11.1.6"
},
"require-dev": {
"phpunit\/phpunit": "^9.5.23"
},
"autoload": {
"psr-4": {
"RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"RectorPrefix202208\\Symplify\\ComposerJsonManipulator\\Tests\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-main": "11.2-dev"
}
},
"conflict": {
"symplify\/easy-coding-standard": "<11.1.6",
"symplify\/phpstan-rules": "<11.1.6",
"symplify\/easy-testing": "<11.1.6",
"symplify\/rule-doc-generator-contracts": "<11.1.6",
"symplify\/php-config-printer": "<11.1.6",
"symplify\/autowire-array-parameter": "<11.1.6",
"symplify\/phpstan-extensions": "<11.1.6",
"symplify\/rule-doc-generator": "<11.1.6",
"symplify\/vendor-patches": "<11.1.6",
"symplify\/skipper": "<11.1.6",
"symplify\/symfony-static-dumper": "<11.1.6",
"symplify\/symplify-kernel": "<9.4.70",
"symplify\/monorepo-builder": "<11.1.6",
"symplify\/config-transformer": "<11.1.6",
"symplify\/easy-ci": "<11.1.6",
"symplify\/coding-standard": "<11.1.6",
"symplify\/easy-parallel": "<11.1.6"
},
"minimum-stability": "dev",
"prefer-stable": true
}

View File

@ -1,25 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208;
use RectorPrefix202208\Symfony\Component\Console\Style\SymfonyStyle;
use RectorPrefix202208\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use RectorPrefix202208\Symplify\ComposerJsonManipulator\ValueObject\Option;
use RectorPrefix202208\Symplify\PackageBuilder\Console\Style\SymfonyStyleFactory;
use RectorPrefix202208\Symplify\PackageBuilder\Parameter\ParameterProvider;
use RectorPrefix202208\Symplify\PackageBuilder\Reflection\PrivatesCaller;
use RectorPrefix202208\Symplify\SmartFileSystem\SmartFileSystem;
use function RectorPrefix202208\Symfony\Component\DependencyInjection\Loader\Configurator\service;
return static function (ContainerConfigurator $containerConfigurator) : void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::INLINE_SECTIONS, ['keywords']);
$services = $containerConfigurator->services();
$services->defaults()->public()->autowire();
$services->load('RectorPrefix202208\Symplify\\ComposerJsonManipulator\\', __DIR__ . '/../src');
$services->set(SmartFileSystem::class);
$services->set(PrivatesCaller::class);
$services->set(ParameterProvider::class)->args([service('service_container')]);
$services->set(SymfonyStyleFactory::class);
$services->set(SymfonyStyle::class)->factory([service(SymfonyStyleFactory::class), 'create']);
};

View File

@ -1,131 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\ComposerJsonManipulator;
use RectorPrefix202208\Nette\Utils\Json;
use RectorPrefix202208\Symplify\ComposerJsonManipulator\FileSystem\JsonFileManager;
use RectorPrefix202208\Symplify\ComposerJsonManipulator\ValueObject\ComposerJson;
use RectorPrefix202208\Symplify\ComposerJsonManipulator\ValueObject\ComposerJsonSection;
use Symplify\SmartFileSystem\SmartFileInfo;
/**
* @api
* @see \Symplify\ComposerJsonManipulator\Tests\ComposerJsonFactory\ComposerJsonFactoryTest
*/
final class ComposerJsonFactory
{
/**
* @var \Symplify\ComposerJsonManipulator\FileSystem\JsonFileManager
*/
private $jsonFileManager;
public function __construct(JsonFileManager $jsonFileManager)
{
$this->jsonFileManager = $jsonFileManager;
}
public function createFromString(string $jsonString) : ComposerJson
{
$jsonArray = Json::decode($jsonString, Json::FORCE_ARRAY);
return $this->createFromArray($jsonArray);
}
public function createFromFileInfo(SmartFileInfo $smartFileInfo) : ComposerJson
{
$jsonArray = $this->jsonFileManager->loadFromFilePath($smartFileInfo->getRealPath());
$composerJson = $this->createFromArray($jsonArray);
$composerJson->setOriginalFileInfo($smartFileInfo);
return $composerJson;
}
public function createFromFilePath(string $filePath) : ComposerJson
{
$jsonArray = $this->jsonFileManager->loadFromFilePath($filePath);
$composerJson = $this->createFromArray($jsonArray);
$fileInfo = new SmartFileInfo($filePath);
$composerJson->setOriginalFileInfo($fileInfo);
return $composerJson;
}
public function createEmpty() : ComposerJson
{
return new ComposerJson();
}
/**
* @param mixed[] $jsonArray
*/
public function createFromArray(array $jsonArray) : ComposerJson
{
$composerJson = new ComposerJson();
if (isset($jsonArray[ComposerJsonSection::CONFIG])) {
$composerJson->setConfig($jsonArray[ComposerJsonSection::CONFIG]);
}
if (isset($jsonArray[ComposerJsonSection::NAME])) {
$composerJson->setName($jsonArray[ComposerJsonSection::NAME]);
}
if (isset($jsonArray[ComposerJsonSection::TYPE])) {
$composerJson->setType($jsonArray[ComposerJsonSection::TYPE]);
}
if (isset($jsonArray[ComposerJsonSection::AUTHORS])) {
$composerJson->setAuthors($jsonArray[ComposerJsonSection::AUTHORS]);
}
if (isset($jsonArray[ComposerJsonSection::DESCRIPTION])) {
$composerJson->setDescription($jsonArray[ComposerJsonSection::DESCRIPTION]);
}
if (isset($jsonArray[ComposerJsonSection::KEYWORDS])) {
$composerJson->setKeywords($jsonArray[ComposerJsonSection::KEYWORDS]);
}
if (isset($jsonArray[ComposerJsonSection::HOMEPAGE])) {
$composerJson->setHomepage($jsonArray[ComposerJsonSection::HOMEPAGE]);
}
if (isset($jsonArray[ComposerJsonSection::LICENSE])) {
$composerJson->setLicense($jsonArray[ComposerJsonSection::LICENSE]);
}
if (isset($jsonArray[ComposerJsonSection::BIN])) {
$composerJson->setBin($jsonArray[ComposerJsonSection::BIN]);
}
if (isset($jsonArray[ComposerJsonSection::REQUIRE])) {
$composerJson->setRequire($jsonArray[ComposerJsonSection::REQUIRE]);
}
if (isset($jsonArray[ComposerJsonSection::REQUIRE_DEV])) {
$composerJson->setRequireDev($jsonArray[ComposerJsonSection::REQUIRE_DEV]);
}
if (isset($jsonArray[ComposerJsonSection::AUTOLOAD])) {
$composerJson->setAutoload($jsonArray[ComposerJsonSection::AUTOLOAD]);
}
if (isset($jsonArray[ComposerJsonSection::AUTOLOAD_DEV])) {
$composerJson->setAutoloadDev($jsonArray[ComposerJsonSection::AUTOLOAD_DEV]);
}
if (isset($jsonArray[ComposerJsonSection::REPLACE])) {
$composerJson->setReplace($jsonArray[ComposerJsonSection::REPLACE]);
}
if (isset($jsonArray[ComposerJsonSection::EXTRA])) {
$composerJson->setExtra($jsonArray[ComposerJsonSection::EXTRA]);
}
if (isset($jsonArray[ComposerJsonSection::SCRIPTS])) {
$composerJson->setScripts($jsonArray[ComposerJsonSection::SCRIPTS]);
}
if (isset($jsonArray[ComposerJsonSection::SCRIPTS_DESCRIPTIONS])) {
$composerJson->setScriptsDescriptions($jsonArray[ComposerJsonSection::SCRIPTS_DESCRIPTIONS]);
}
if (isset($jsonArray[ComposerJsonSection::SUGGEST])) {
$composerJson->setSuggest($jsonArray[ComposerJsonSection::SUGGEST]);
}
if (isset($jsonArray[ComposerJsonSection::MINIMUM_STABILITY])) {
$composerJson->setMinimumStability($jsonArray[ComposerJsonSection::MINIMUM_STABILITY]);
}
if (isset($jsonArray[ComposerJsonSection::PREFER_STABLE])) {
$composerJson->setPreferStable($jsonArray[ComposerJsonSection::PREFER_STABLE]);
}
if (isset($jsonArray[ComposerJsonSection::CONFLICT])) {
$composerJson->setConflicts($jsonArray[ComposerJsonSection::CONFLICT]);
}
if (isset($jsonArray[ComposerJsonSection::REPOSITORIES])) {
$composerJson->setRepositories($jsonArray[ComposerJsonSection::REPOSITORIES]);
}
if (isset($jsonArray[ComposerJsonSection::VERSION])) {
$composerJson->setVersion($jsonArray[ComposerJsonSection::VERSION]);
}
if (isset($jsonArray[ComposerJsonSection::PROVIDE])) {
$composerJson->setProvide($jsonArray[ComposerJsonSection::PROVIDE]);
}
$orderedKeys = \array_keys($jsonArray);
$composerJson->setOrderedKeys($orderedKeys);
return $composerJson;
}
}

View File

@ -1,97 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\ComposerJsonManipulator\FileSystem;
use RectorPrefix202208\Nette\Utils\Json;
use RectorPrefix202208\Symplify\ComposerJsonManipulator\Json\JsonCleaner;
use RectorPrefix202208\Symplify\ComposerJsonManipulator\Json\JsonInliner;
use RectorPrefix202208\Symplify\ComposerJsonManipulator\ValueObject\ComposerJson;
use RectorPrefix202208\Symplify\PackageBuilder\Configuration\StaticEolConfiguration;
use Symplify\SmartFileSystem\SmartFileInfo;
use RectorPrefix202208\Symplify\SmartFileSystem\SmartFileSystem;
/**
* @see \Symplify\MonorepoBuilder\Tests\FileSystem\JsonFileManager\JsonFileManagerTest
*/
final class JsonFileManager
{
/**
* @var array<string, mixed[]>
*/
private $cachedJSONFiles = [];
/**
* @var \Symplify\SmartFileSystem\SmartFileSystem
*/
private $smartFileSystem;
/**
* @var \Symplify\ComposerJsonManipulator\Json\JsonCleaner
*/
private $jsonCleaner;
/**
* @var \Symplify\ComposerJsonManipulator\Json\JsonInliner
*/
private $jsonInliner;
public function __construct(SmartFileSystem $smartFileSystem, JsonCleaner $jsonCleaner, JsonInliner $jsonInliner)
{
$this->smartFileSystem = $smartFileSystem;
$this->jsonCleaner = $jsonCleaner;
$this->jsonInliner = $jsonInliner;
}
/**
* @return mixed[]
*/
public function loadFromFileInfo(SmartFileInfo $smartFileInfo) : array
{
$realPath = $smartFileInfo->getRealPath();
if (!isset($this->cachedJSONFiles[$realPath])) {
$this->cachedJSONFiles[$realPath] = Json::decode($smartFileInfo->getContents(), Json::FORCE_ARRAY);
}
return $this->cachedJSONFiles[$realPath];
}
/**
* @return array<string, mixed>
*/
public function loadFromFilePath(string $filePath) : array
{
$fileContent = $this->smartFileSystem->readFile($filePath);
return Json::decode($fileContent, Json::FORCE_ARRAY);
}
/**
* @param mixed[] $json
*/
public function printJsonToFileInfoAndReturn(array $json, SmartFileInfo $smartFileInfo) : string
{
$jsonString = $this->encodeJsonToFileContent($json);
$this->printJsonStringToSmartFileInfo($smartFileInfo, $jsonString);
return $jsonString;
}
/**
* @param mixed[] $json
*/
public function printJsonToFileInfo(array $json, SmartFileInfo $smartFileInfo) : void
{
$jsonString = $this->encodeJsonToFileContent($json);
$this->printJsonStringToSmartFileInfo($smartFileInfo, $jsonString);
}
public function printComposerJsonToFilePath(ComposerJson $composerJson, string $filePath) : void
{
$jsonString = $this->encodeJsonToFileContent($composerJson->getJsonArray());
$this->smartFileSystem->dumpFile($filePath, $jsonString);
}
/**
* @param mixed[] $json
*/
public function encodeJsonToFileContent(array $json) : string
{
// Empty arrays may lead to bad encoding since we can't be sure whether they need to be arrays or objects.
$json = $this->jsonCleaner->removeEmptyKeysFromJsonArray($json);
$jsonContent = Json::encode($json, Json::PRETTY) . StaticEolConfiguration::getEolChar();
return $this->jsonInliner->inlineSections($jsonContent);
}
private function printJsonStringToSmartFileInfo(SmartFileInfo $smartFileInfo, string $jsonString) : void
{
$this->smartFileSystem->dumpFile($smartFileInfo->getPathname(), $jsonString);
$realPath = $smartFileInfo->getRealPath();
unset($this->cachedJSONFiles[$realPath]);
}
}

View File

@ -1,26 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\ComposerJsonManipulator\Json;
final class JsonCleaner
{
/**
* @param array<int|string, mixed> $data
* @return array<int|string, mixed>
*/
public function removeEmptyKeysFromJsonArray(array $data) : array
{
foreach ($data as $key => $value) {
if (!\is_array($value)) {
continue;
}
if ($value === []) {
unset($data[$key]);
} else {
$data[$key] = $this->removeEmptyKeysFromJsonArray($value);
}
}
return $data;
}
}

View File

@ -1,41 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\ComposerJsonManipulator\Json;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202208\Symplify\ComposerJsonManipulator\ValueObject\Option;
use RectorPrefix202208\Symplify\PackageBuilder\Parameter\ParameterProvider;
final class JsonInliner
{
/**
* @var string
* @see https://regex101.com/r/jhWo9g/1
*/
private const SPACE_REGEX = '#\\s+#';
/**
* @var \Symplify\PackageBuilder\Parameter\ParameterProvider
*/
private $parameterProvider;
public function __construct(ParameterProvider $parameterProvider)
{
$this->parameterProvider = $parameterProvider;
}
public function inlineSections(string $jsonContent) : string
{
if (!$this->parameterProvider->hasParameter(Option::INLINE_SECTIONS)) {
return $jsonContent;
}
$inlineSections = $this->parameterProvider->provideArrayParameter(Option::INLINE_SECTIONS);
foreach ($inlineSections as $inlineSection) {
$pattern = '#("' . \preg_quote($inlineSection, '#') . '": )\\[(.*?)\\](,)#ms';
$jsonContent = Strings::replace($jsonContent, $pattern, static function (array $match) : string {
$inlined = Strings::replace($match[2], self::SPACE_REGEX, ' ');
$inlined = \trim($inlined);
$inlined = '[' . $inlined . ']';
return $match[1] . $inlined . $match[3];
});
}
return $jsonContent;
}
}

View File

@ -1,37 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\ComposerJsonManipulator\Printer;
use RectorPrefix202208\Symplify\ComposerJsonManipulator\FileSystem\JsonFileManager;
use RectorPrefix202208\Symplify\ComposerJsonManipulator\ValueObject\ComposerJson;
use Symplify\SmartFileSystem\SmartFileInfo;
/**
* @api
*/
final class ComposerJsonPrinter
{
/**
* @var \Symplify\ComposerJsonManipulator\FileSystem\JsonFileManager
*/
private $jsonFileManager;
public function __construct(JsonFileManager $jsonFileManager)
{
$this->jsonFileManager = $jsonFileManager;
}
public function printToString(ComposerJson $composerJson) : string
{
return $this->jsonFileManager->encodeJsonToFileContent($composerJson->getJsonArray());
}
/**
* @param string|\Symplify\SmartFileSystem\SmartFileInfo $targetFile
*/
public function print(ComposerJson $composerJson, $targetFile) : void
{
if (\is_string($targetFile)) {
$this->jsonFileManager->printComposerJsonToFilePath($composerJson, $targetFile);
return;
}
$this->jsonFileManager->printJsonToFileInfo($composerJson->getJsonArray(), $targetFile);
}
}

View File

@ -1,65 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\ComposerJsonManipulator\Sorter;
use RectorPrefix202208\Nette\Utils\Strings;
/**
* Mostly inspired by https://github.com/composer/composer/blob/master/src/Composer/Json/JsonManipulator.php
*
* @see \Symplify\ComposerJsonManipulator\Tests\Sorter\ComposerPackageSorterTest
*/
final class ComposerPackageSorter
{
/**
* @see https://regex101.com/r/tMrjMY/1
* @var string
*/
private const PLATFORM_PACKAGE_REGEX = '#^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-(?:plugin|runtime)-api)$#iD';
/**
* @see https://regex101.com/r/SXZcfb/1
* @var string
*/
private const REQUIREMENT_TYPE_REGEX = '#^(?<name>php|hhvm|ext|lib|\\D)#';
/**
* Sorts packages by importance (platform packages first, then PHP dependencies) and alphabetically.
*
* @link https://getcomposer.org/doc/02-libraries.md#platform-packages
*
* @param array<string, string> $packages
* @return array<string, string>
*/
public function sortPackages(array $packages) : array
{
\uksort($packages, function (string $firstPackageName, string $secondPackageName) : int {
return $this->createNameWithPriority($firstPackageName) <=> $this->createNameWithPriority($secondPackageName);
});
return $packages;
}
private function createNameWithPriority(string $requirementName) : string
{
if ($this->isPlatformPackage($requirementName)) {
return Strings::replace($requirementName, self::REQUIREMENT_TYPE_REGEX, static function (array $match) : string {
$name = $match['name'];
if ($name === 'php') {
return '0-' . $name;
}
if ($name === 'hhvm') {
return '0-' . $name;
}
if ($name === 'ext') {
return '1-' . $name;
}
if ($name === 'lib') {
return '2-' . $name;
}
return '3-' . $name;
});
}
return '4-' . $requirementName;
}
private function isPlatformPackage(string $name) : bool
{
return (bool) Strings::match($name, self::PLATFORM_PACKAGE_REGEX);
}
}

View File

@ -1,731 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\ComposerJsonManipulator\ValueObject;
use RectorPrefix202208\Nette\Utils\Arrays;
use RectorPrefix202208\Nette\Utils\Strings;
use RectorPrefix202208\Symplify\ComposerJsonManipulator\Sorter\ComposerPackageSorter;
use Symplify\SmartFileSystem\SmartFileInfo;
use RectorPrefix202208\Symplify\SymplifyKernel\Exception\ShouldNotHappenException;
/**
* @api
* @see \Symplify\ComposerJsonManipulator\Tests\ValueObject\ComposerJsonTest
*/
final class ComposerJson
{
/**
* @var string
*/
private const CLASSMAP_KEY = 'classmap';
/**
* @var string
*/
private const PHP = 'php';
/**
* @var string|null
*/
private $name;
/**
* @var string|null
*/
private $description;
/**
* @var string[]
*/
private $keywords = [];
/**
* @var string|null
*/
private $homepage;
/**
* @var string|string[]|null
*/
private $license = null;
/**
* @var string|null
*/
private $minimumStability;
/**
* @var bool|null
*/
private $preferStable;
/**
* @var mixed[]
*/
private $repositories = [];
/**
* @var array<string, string>
*/
private $require = [];
/**
* @var mixed[]
*/
private $autoload = [];
/**
* @var mixed[]
*/
private $extra = [];
/**
* @var array<string, string>
*/
private $requireDev = [];
/**
* @var mixed[]
*/
private $autoloadDev = [];
/**
* @var string[]
*/
private $orderedKeys = [];
/**
* @var array<string, string>
*/
private $replace = [];
/**
* @var array<string, string|string[]>
*/
private $scripts = [];
/**
* @var mixed[]
*/
private $config = [];
/**
* @var \Symplify\SmartFileSystem\SmartFileInfo|null
*/
private $fileInfo;
/**
* @var \Symplify\ComposerJsonManipulator\Sorter\ComposerPackageSorter
*/
private $composerPackageSorter;
/**
* @var array<string, string>
*/
private $conflicts = [];
/**
* @var mixed[]
*/
private $bin = [];
/**
* @var string|null
*/
private $type;
/**
* @var mixed[]
*/
private $authors = [];
/**
* @var array<string, string>
*/
private $scriptsDescriptions = [];
/**
* @var array<string, string>
*/
private $suggest = [];
/**
* @var string|null
*/
private $version;
/**
* @var array<string, string>
*/
private $provide = [];
public function __construct()
{
$this->composerPackageSorter = new ComposerPackageSorter();
}
public function setOriginalFileInfo(SmartFileInfo $fileInfo) : void
{
$this->fileInfo = $fileInfo;
}
public function setName(string $name) : void
{
$this->name = $name;
}
public function setType(string $type) : void
{
$this->type = $type;
}
/**
* @param array<string, string> $require
*/
public function setRequire(array $require) : void
{
$this->require = $this->sortPackagesIfNeeded($require);
}
public function getVersion() : ?string
{
return $this->version;
}
public function setVersion(string $version) : void
{
$this->version = $version;
}
/**
* @return mixed[]
*/
public function getRequire() : array
{
return $this->require;
}
public function getRequirePhpVersion() : ?string
{
return $this->require[self::PHP] ?? null;
}
/**
* @return array<string, string>
*/
public function getRequireDev() : array
{
return $this->requireDev;
}
/**
* @param array<string, string> $requireDev
*/
public function setRequireDev(array $requireDev) : void
{
$this->requireDev = $this->sortPackagesIfNeeded($requireDev);
}
/**
* @param string[] $orderedKeys
*/
public function setOrderedKeys(array $orderedKeys) : void
{
$this->orderedKeys = $orderedKeys;
}
/**
* @return string[]
*/
public function getOrderedKeys() : array
{
return $this->orderedKeys;
}
/**
* @return mixed[]
*/
public function getAutoload() : array
{
return $this->autoload;
}
/**
* @return string[]
*/
public function getAbsoluteAutoloadDirectories() : array
{
if ($this->fileInfo === null) {
throw new ShouldNotHappenException();
}
$autoloadDirectories = $this->getAutoloadDirectories();
$absoluteAutoloadDirectories = [];
foreach ($autoloadDirectories as $autoloadDirectory) {
if (\is_file($autoloadDirectory)) {
// skip files
continue;
}
$absoluteAutoloadDirectories[] = $this->resolveExistingAutoloadDirectory($autoloadDirectory);
}
return $absoluteAutoloadDirectories;
}
/**
* @param mixed[] $autoload
*/
public function setAutoload(array $autoload) : void
{
$this->autoload = $autoload;
}
/**
* @return mixed[]
*/
public function getAutoloadDev() : array
{
return $this->autoloadDev;
}
/**
* @param mixed[] $autoloadDev
*/
public function setAutoloadDev(array $autoloadDev) : void
{
$this->autoloadDev = $autoloadDev;
}
/**
* @return mixed[]
*/
public function getRepositories() : array
{
return $this->repositories;
}
/**
* @param mixed[] $repositories
*/
public function setRepositories(array $repositories) : void
{
$this->repositories = $repositories;
}
public function setMinimumStability(string $minimumStability) : void
{
$this->minimumStability = $minimumStability;
}
public function removeMinimumStability() : void
{
$this->minimumStability = null;
}
public function getMinimumStability() : ?string
{
return $this->minimumStability;
}
public function getPreferStable() : ?bool
{
return $this->preferStable;
}
public function setPreferStable(bool $preferStable) : void
{
$this->preferStable = $preferStable;
}
public function removePreferStable() : void
{
$this->preferStable = null;
}
/**
* @return mixed[]
*/
public function getExtra() : array
{
return $this->extra;
}
/**
* @param mixed[] $extra
*/
public function setExtra(array $extra) : void
{
$this->extra = $extra;
}
public function getName() : ?string
{
return $this->name;
}
public function getVendorName() : ?string
{
if ($this->name === null) {
return null;
}
[$vendor] = \explode('/', $this->name);
return $vendor;
}
public function getShortName() : ?string
{
if ($this->name === null) {
return null;
}
return Strings::after($this->name, '/', -1);
}
/**
* @return array<string, string>
*/
public function getReplace() : array
{
return $this->replace;
}
public function isReplacePackageSet(string $packageName) : bool
{
return isset($this->replace[$packageName]);
}
/**
* @param array<string, string> $replace
*/
public function setReplace(array $replace) : void
{
\ksort($replace);
$this->replace = $replace;
}
public function setReplacePackage(string $packageName, string $version) : void
{
$this->replace[$packageName] = $version;
}
/**
* @return mixed[]
*/
public function getJsonArray() : array
{
$array = \array_filter([ComposerJsonSection::NAME => $this->name, ComposerJsonSection::DESCRIPTION => $this->description, ComposerJsonSection::KEYWORDS => $this->keywords, ComposerJsonSection::HOMEPAGE => $this->homepage, ComposerJsonSection::LICENSE => $this->license, ComposerJsonSection::AUTHORS => $this->authors, ComposerJsonSection::TYPE => $this->type, ComposerJsonSection::REQUIRE => $this->require, ComposerJsonSection::REQUIRE_DEV => $this->requireDev, ComposerJsonSection::AUTOLOAD => $this->autoload, ComposerJsonSection::AUTOLOAD_DEV => $this->autoloadDev, ComposerJsonSection::REPOSITORIES => $this->repositories, ComposerJsonSection::EXTRA => $this->extra, ComposerJsonSection::BIN => $this->bin, ComposerJsonSection::SCRIPTS => $this->scripts, ComposerJsonSection::SCRIPTS_DESCRIPTIONS => $this->scriptsDescriptions, ComposerJsonSection::SUGGEST => $this->suggest, ComposerJsonSection::CONFIG => $this->config, ComposerJsonSection::REPLACE => $this->replace, ComposerJsonSection::CONFLICT => $this->conflicts, ComposerJsonSection::PROVIDE => $this->provide, ComposerJsonSection::VERSION => $this->version]);
if ($this->minimumStability !== null) {
$array[ComposerJsonSection::MINIMUM_STABILITY] = $this->minimumStability;
$this->moveValueToBack(ComposerJsonSection::MINIMUM_STABILITY);
}
if ($this->preferStable !== null) {
$array[ComposerJsonSection::PREFER_STABLE] = $this->preferStable;
$this->moveValueToBack(ComposerJsonSection::PREFER_STABLE);
}
return $this->sortItemsByOrderedListOfKeys($array, $this->orderedKeys);
}
/**
* @param array<string, string|string[]> $scripts
*/
public function setScripts(array $scripts) : void
{
$this->scripts = $scripts;
}
/**
* @param mixed[] $config
*/
public function setConfig(array $config) : void
{
$this->config = $config;
}
/**
* @return mixed[]
*/
public function getConfig() : array
{
return $this->config;
}
public function setDescription(string $description) : void
{
$this->description = $description;
}
public function getDescription() : ?string
{
return $this->description;
}
/**
* @param string[] $keywords
*/
public function setKeywords(array $keywords) : void
{
$this->keywords = $keywords;
}
/**
* @return string[]
*/
public function getKeywords() : array
{
return $this->keywords;
}
public function setHomepage(string $homepage) : void
{
$this->homepage = $homepage;
}
public function getHomepage() : ?string
{
return $this->homepage;
}
/**
* @param string|string[]|null $license
*/
public function setLicense($license) : void
{
$this->license = $license;
}
/**
* @return string|string[]|null
*/
public function getLicense()
{
return $this->license;
}
/**
* @param mixed[] $authors
*/
public function setAuthors(array $authors) : void
{
$this->authors = $authors;
}
/**
* @return mixed[]
*/
public function getAuthors() : array
{
return $this->authors;
}
public function hasPackage(string $packageName) : bool
{
if ($this->hasRequiredPackage($packageName)) {
return \true;
}
return $this->hasRequiredDevPackage($packageName);
}
public function hasRequiredPackage(string $packageName) : bool
{
return isset($this->require[$packageName]);
}
public function hasRequiredDevPackage(string $packageName) : bool
{
return isset($this->requireDev[$packageName]);
}
public function addRequiredPackage(string $packageName, string $version) : void
{
if (!$this->hasPackage($packageName)) {
$this->require[$packageName] = $version;
$this->require = $this->sortPackagesIfNeeded($this->require);
}
}
public function addRequiredDevPackage(string $packageName, string $version) : void
{
if (!$this->hasPackage($packageName)) {
$this->requireDev[$packageName] = $version;
$this->requireDev = $this->sortPackagesIfNeeded($this->requireDev);
}
}
public function changePackageVersion(string $packageName, string $version) : void
{
if ($this->hasRequiredPackage($packageName)) {
$this->require[$packageName] = $version;
}
if ($this->hasRequiredDevPackage($packageName)) {
$this->requireDev[$packageName] = $version;
}
}
public function movePackageToRequire(string $packageName) : void
{
if (!$this->hasRequiredDevPackage($packageName)) {
return;
}
$version = $this->requireDev[$packageName];
$this->removePackage($packageName);
$this->addRequiredPackage($packageName, $version);
}
public function movePackageToRequireDev(string $packageName) : void
{
if (!$this->hasRequiredPackage($packageName)) {
return;
}
$version = $this->require[$packageName];
$this->removePackage($packageName);
$this->addRequiredDevPackage($packageName, $version);
}
public function removePackage(string $packageName) : void
{
unset($this->require[$packageName], $this->requireDev[$packageName]);
}
public function replacePackage(string $oldPackageName, string $newPackageName, string $targetVersion) : void
{
if ($this->hasRequiredPackage($oldPackageName)) {
unset($this->require[$oldPackageName]);
$this->addRequiredPackage($newPackageName, $targetVersion);
}
if ($this->hasRequiredDevPackage($oldPackageName)) {
unset($this->requireDev[$oldPackageName]);
$this->addRequiredDevPackage($newPackageName, $targetVersion);
}
}
public function getFileInfo() : ?SmartFileInfo
{
return $this->fileInfo;
}
/**
* @param array<string, string> $conflicts
*/
public function setConflicts(array $conflicts) : void
{
$this->conflicts = $conflicts;
}
/**
* @param mixed[] $bin
*/
public function setBin(array $bin) : void
{
$this->bin = $bin;
}
/**
* @return mixed[]
*/
public function getBin() : array
{
return $this->bin;
}
/**
* @return string[]
*/
public function getPsr4AndClassmapDirectories() : array
{
$psr4Directories = \array_values($this->autoload['psr-4'] ?? []);
$classmapDirectories = $this->autoload['classmap'] ?? [];
return \array_merge($psr4Directories, $classmapDirectories);
}
/**
* @return array<string, string|string[]>
*/
public function getScripts() : array
{
return $this->scripts;
}
/**
* @return array<string, string>
*/
public function getScriptsDescriptions() : array
{
return $this->scriptsDescriptions;
}
/**
* @return array<string, string>
*/
public function getSuggest() : array
{
return $this->suggest;
}
/**
* @return string[]
*/
public function getAllClassmaps() : array
{
$autoloadClassmaps = $this->autoload[self::CLASSMAP_KEY] ?? [];
$autoloadDevClassmaps = $this->autoloadDev[self::CLASSMAP_KEY] ?? [];
return \array_merge($autoloadClassmaps, $autoloadDevClassmaps);
}
/**
* @return array<string, string>
*/
public function getConflicts() : array
{
return $this->conflicts;
}
/**
* @api
*/
public function getType() : ?string
{
return $this->type;
}
/**
* @return string[]
*/
public function getAutoloadDirectories() : array
{
$autoloadDirectories = \array_merge($this->getPsr4AndClassmapDirectories(), $this->getPsr4AndClassmapDevDirectories());
return Arrays::flatten($autoloadDirectories);
}
/**
* @return string[]
*/
public function getPsr4AndClassmapDevDirectories() : array
{
$psr4Directories = \array_values($this->autoloadDev['psr-4'] ?? []);
$classmapDirectories = $this->autoloadDev['classmap'] ?? [];
return \array_merge($psr4Directories, $classmapDirectories);
}
/**
* @param array<string, string> $scriptsDescriptions
*/
public function setScriptsDescriptions(array $scriptsDescriptions) : void
{
$this->scriptsDescriptions = $scriptsDescriptions;
}
/**
* @param array<string, string> $suggest
*/
public function setSuggest(array $suggest) : void
{
$this->suggest = $suggest;
}
/**
* @return string[]
*/
public function getDuplicatedRequirePackages() : array
{
$requiredPackageNames = $this->require;
$requiredDevPackageNames = $this->requireDev;
return \array_intersect($requiredPackageNames, $requiredDevPackageNames);
}
/**
* @return string[]
*/
public function getRequirePackageNames() : array
{
return \array_keys($this->require);
}
/**
* @return array<string, string>
*/
public function getProvide() : array
{
return $this->provide;
}
public function isProvidePackageSet(string $packageName) : bool
{
return isset($this->provide[$packageName]);
}
/**
* @param array<string, string> $provide
*/
public function setProvide(array $provide) : void
{
\ksort($provide);
$this->provide = $provide;
}
public function setProvidePackage(string $packageName, string $version) : void
{
$this->provide[$packageName] = $version;
}
/**
* @param ComposerJsonSection::* $valueName
*/
private function moveValueToBack(string $valueName) : void
{
$key = \array_search($valueName, $this->orderedKeys, \true);
if ($key !== \false) {
unset($this->orderedKeys[$key]);
}
$this->orderedKeys[] = $valueName;
}
/**
* 2. sort item by prescribed key order
*
* @see https://www.designcise.com/web/tutorial/how-to-sort-an-array-by-keys-based-on-order-in-a-secondary-array-in-php
* @param array<string, mixed> $contentItems
* @param string[] $orderedVisibleItems
* @return mixed[]
*/
private function sortItemsByOrderedListOfKeys(array $contentItems, array $orderedVisibleItems) : array
{
\uksort($contentItems, function ($firstContentItem, $secondContentItem) use($orderedVisibleItems) : int {
$firstItemPosition = $this->findPosition($firstContentItem, $orderedVisibleItems);
$secondItemPosition = $this->findPosition($secondContentItem, $orderedVisibleItems);
if ($firstItemPosition === \false) {
// new item, put in the back
return -1;
}
if ($secondItemPosition === \false) {
// new item, put in the back
return -1;
}
return $firstItemPosition <=> $secondItemPosition;
});
return $contentItems;
}
private function resolveExistingAutoloadDirectory(string $autoloadDirectory) : string
{
if ($this->fileInfo === null) {
throw new ShouldNotHappenException();
}
$filePathCandidates = [
$this->fileInfo->getPath() . \DIRECTORY_SEPARATOR . $autoloadDirectory,
// mostly tests
\getcwd() . \DIRECTORY_SEPARATOR . $autoloadDirectory,
];
foreach ($filePathCandidates as $filePathCandidate) {
if (\file_exists($filePathCandidate)) {
return $filePathCandidate;
}
}
return $autoloadDirectory;
}
/**
* @param array<string, string> $packages
* @return array<string, string>
*/
private function sortPackagesIfNeeded(array $packages) : array
{
$sortPackages = $this->config['sort-packages'] ?? \false;
if ($sortPackages) {
return $this->composerPackageSorter->sortPackages($packages);
}
return $packages;
}
/**
* @param string[] $items
* @return int|string|bool
*/
private function findPosition(string $key, array $items)
{
return \array_search($key, $items, \true);
}
}

View File

@ -1,15 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\ComposerJsonManipulator\ValueObject;
/**
* @api
*/
final class ComposerJsonManipulatorConfig
{
/**
* @var string
*/
public const FILE_PATH = __DIR__ . '/../../config/config.php';
}

View File

@ -1,108 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\ComposerJsonManipulator\ValueObject;
/**
* @api
*/
final class ComposerJsonSection
{
/**
* @var string
*/
public const REPOSITORIES = 'repositories';
/**
* @var string
*/
public const REQUIRE_DEV = 'require-dev';
/**
* @var string
*/
public const REQUIRE = 'require';
/**
* @var string
*/
public const CONFLICT = 'conflict';
/**
* @var string
*/
public const PREFER_STABLE = 'prefer-stable';
/**
* @var string
*/
public const MINIMUM_STABILITY = 'minimum-stability';
/**
* @var string
*/
public const AUTOLOAD = 'autoload';
/**
* @var string
*/
public const AUTOLOAD_DEV = 'autoload-dev';
/**
* @var string
*/
public const REPLACE = 'replace';
/**
* @var string
*/
public const CONFIG = 'config';
/**
* @var string
*/
public const EXTRA = 'extra';
/**
* @var string
*/
public const NAME = 'name';
/**
* @var string
*/
public const DESCRIPTION = 'description';
/**
* @var string
*/
public const KEYWORDS = 'keywords';
/**
* @var string
*/
public const HOMEPAGE = 'homepage';
/**
* @var string
*/
public const LICENSE = 'license';
/**
* @var string
*/
public const SCRIPTS = 'scripts';
/**
* @var string
*/
public const BIN = 'bin';
/**
* @var string
*/
public const TYPE = 'type';
/**
* @var string
*/
public const AUTHORS = 'authors';
/**
* @var string
*/
public const PROVIDE = 'provide';
/**
* @var string
* @see https://getcomposer.org/doc/articles/scripts.md#custom-descriptions-
*/
public const SCRIPTS_DESCRIPTIONS = 'scripts-descriptions';
/**
* @var string
*/
public const SUGGEST = 'suggest';
/**
* @var string
*/
public const VERSION = 'version';
}

View File

@ -1,13 +0,0 @@
<?php
declare (strict_types=1);
namespace RectorPrefix202208\Symplify\ComposerJsonManipulator\ValueObject;
final class Option
{
/**
* @var string
* @api
*/
public const INLINE_SECTIONS = 'inline_sections';
}

View File

@ -10,7 +10,7 @@
"symfony\/console": "^6.0",
"symfony\/dependency-injection": "^6.0",
"symfony\/finder": "^6.0",
"symplify\/symplify-kernel": "^11.1.6"
"symplify\/symplify-kernel": "^11.2"
},
"require-dev": {
"phpunit\/phpunit": "^9.5.23"

View File

@ -6,10 +6,9 @@
"php": ">=8.0",
"symfony\/console": "^6.0",
"symfony\/dependency-injection": "^6.0",
"symplify\/smart-file-system": "^11.1.6",
"symplify\/composer-json-manipulator": "^11.1.6",
"symplify\/autowire-array-parameter": "^11.1.6",
"symplify\/package-builder": "^11.1.6",
"symplify\/smart-file-system": "^11.2",
"symplify\/autowire-array-parameter": "^11.2",
"symplify\/package-builder": "^11.2",
"webmozart\/assert": "^1.10"
},
"require-dev": {