From 04947c45b29b8436ee7d4a62e02ccd0150303ab5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=B6ller?= <am@localheinz.com>
Date: Wed, 30 Mar 2022 11:54:28 +0200
Subject: [PATCH 1/2] Enhancement: Update composer/composer

---
 .github/workflows/integrate.yaml |   2 +-
 .github/workflows/release.yaml   |   2 +-
 CHANGELOG.md                     |  12 ++-
 Makefile                         |   2 +-
 composer.json                    |   2 +-
 composer.lock                    | 126 +++++++++++++++++++------------
 6 files changed, 93 insertions(+), 53 deletions(-)

diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml
index 35978abc..290b8de0 100644
--- a/.github/workflows/integrate.yaml
+++ b/.github/workflows/integrate.yaml
@@ -147,7 +147,7 @@ jobs:
 
     env:
       COMPOSER_NORMALIZE_PHAR: ".build/phar/composer-normalize.phar"
-      COMPOSER_VERSION: "2.2.9"
+      COMPOSER_VERSION: "2.3.0"
 
     steps:
       - name: "Checkout"
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 89990e9b..a720c4a4 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -24,7 +24,7 @@ jobs:
     env:
       COMPOSER_NORMALIZE_PHAR: ".build/phar/composer-normalize.phar"
       COMPOSER_NORMALIZE_PHAR_SIGNATURE: ".build/phar/composer-normalize.phar.asc"
-      COMPOSER_VERSION: "2.2.9"
+      COMPOSER_VERSION: "2.3.0"
       GPG_KEYS: ".build/phar/keys.asc"
       GPG_KEYS_ENCRYPTED: "phar/keys.asc.gpg"
 
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 96e6ba7c..1dcd6077 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,11 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 
 ## Unreleased
 
-For a full diff see [`2.24.1...main`][2.24.1...main].
+For a full diff see [`2.25.0...main`][2.25.0...main].
+
+## [`2.25.0`][2.25.0]
+
+For a full diff see [`2.24.1...2.25.0`][2.24.1...2.25.0].
 
 ### Changed
 
 - Updated `schema.json` ([#912]), by [@ergebnis-bot]
+- Required `composer/composer:2.3.0` for compiling `composer-normalize.phar` ([#913]), by [@localheinz]
 
 ## [`2.24.1`][2.24.1]
 
@@ -707,6 +712,7 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
 [2.23.1]: https://github.com/ergebnis/composer-normalize/releases/tag/2.23.1
 [2.24.0]: https://github.com/ergebnis/composer-normalize/releases/tag/2.24.0
 [2.24.1]: https://github.com/ergebnis/composer-normalize/releases/tag/2.24.1
+[2.25.0]: https://github.com/ergebnis/composer-normalize/releases/tag/2.25.0
 
 [81bc3a8...0.1.0]: https://github.com/ergebnis/composer-normalize/compare/81bc3a8...0.1.0
 [0.1.0...0.2.0]: https://github.com/ergebnis/composer-normalize/compare/0.1.0...0.2.0
@@ -775,7 +781,8 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
 [2.23.0...2.23.1]: https://github.com/ergebnis/composer-normalize/compare/2.23.0...2.23.1
 [2.23.1...2.24.0]: https://github.com/ergebnis/composer-normalize/compare/2.23.1...2.24.0
 [2.24.0...2.24.1]: https://github.com/ergebnis/composer-normalize/compare/2.24.0...2.24.1
-[2.24.1...main]: https://github.com/ergebnis/composer-normalize/compare/2.24.1...main
+[2.24.1...2.25.0]: https://github.com/ergebnis/composer-normalize/compare/2.24.1...2.25.10
+[2.25.0...main]: https://github.com/ergebnis/composer-normalize/compare/2.25.0...main
 
 [#1]: https://github.com/ergebnis/composer-normalize/pull/1
 [#2]: https://github.com/ergebnis/composer-normalize/pull/2
@@ -874,6 +881,7 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
 [#904]: https://github.com/ergebnis/composer-normalize/pull/904
 [#905]: https://github.com/ergebnis/composer-normalize/pull/905
 [#912]: https://github.com/ergebnis/composer-normalize/pull/912
+[#913]: https://github.com/ergebnis/composer-normalize/pull/913
 
 [@core23]: https://github.com/core23
 [@dependabot]: https://github.com/dependabot
diff --git a/Makefile b/Makefile
index b4fe3ef6..12acac42 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-COMPOSER_VERSION:=2.2.9
+COMPOSER_VERSION:=2.3.0
 
 .PHONY: it
 it: coding-standards static-code-analysis tests ## Runs the coding-standards, static-code-analysis, and tests targets
diff --git a/composer.json b/composer.json
index c9ccb7fd..90365f9b 100644
--- a/composer.json
+++ b/composer.json
@@ -29,7 +29,7 @@
     "localheinz/diff": "^1.1.1"
   },
   "require-dev": {
-    "composer/composer": "^2.2.9",
+    "composer/composer": "^2.3.0",
     "ergebnis/license": "^1.2.0",
     "ergebnis/php-cs-fixer-config": "^4.4.0",
     "fakerphp/faker": "^1.19.0",
diff --git a/composer.lock b/composer.lock
index b35e9f81..21098c7c 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "390091dc1ffdcb559e5258a352945885",
+    "content-hash": "c38db0a5ce8fb08c49b705a0176f2e96",
     "packages": [
         {
             "name": "ergebnis/json-normalizer",
@@ -581,39 +581,45 @@
         },
         {
             "name": "composer/composer",
-            "version": "2.2.9",
+            "version": "2.3.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/composer/composer.git",
-                "reference": "07eccf080ad63d55d95a7c9133506db7d9029264"
+                "reference": "934ee6eed3c3ffd0aeccef7c1d255adcf0752b24"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/composer/composer/zipball/07eccf080ad63d55d95a7c9133506db7d9029264",
-                "reference": "07eccf080ad63d55d95a7c9133506db7d9029264",
+                "url": "https://api.github.com/repos/composer/composer/zipball/934ee6eed3c3ffd0aeccef7c1d255adcf0752b24",
+                "reference": "934ee6eed3c3ffd0aeccef7c1d255adcf0752b24",
                 "shasum": ""
             },
             "require": {
                 "composer/ca-bundle": "^1.0",
                 "composer/metadata-minifier": "^1.0",
-                "composer/pcre": "^1.0",
+                "composer/pcre": "^2 || ^3",
                 "composer/semver": "^3.0",
                 "composer/spdx-licenses": "^1.2",
-                "composer/xdebug-handler": "^2.0 || ^3.0",
+                "composer/xdebug-handler": "^2.0.2 || ^3.0.3",
                 "justinrainbow/json-schema": "^5.2.11",
-                "php": "^5.3.2 || ^7.0 || ^8.0",
-                "psr/log": "^1.0 || ^2.0",
-                "react/promise": "^1.2 || ^2.7",
+                "php": "^7.2.5 || ^8.0",
+                "psr/log": "^1.0 || ^2.0 || ^3.0",
+                "react/promise": "^2.8",
                 "seld/jsonlint": "^1.4",
-                "seld/phar-utils": "^1.0",
-                "symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0",
-                "symfony/filesystem": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
-                "symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
-                "symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0"
+                "seld/phar-utils": "^1.2",
+                "symfony/console": "^5.4.1 || ^6.0",
+                "symfony/filesystem": "^5.4 || ^6.0",
+                "symfony/finder": "^5.4 || ^6.0",
+                "symfony/polyfill-php73": "^1.24",
+                "symfony/polyfill-php80": "^1.24",
+                "symfony/process": "^5.4 || ^6.0"
             },
             "require-dev": {
-                "phpspec/prophecy": "^1.10",
-                "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0"
+                "phpstan/phpstan": "^1.4.1",
+                "phpstan/phpstan-deprecation-rules": "^1",
+                "phpstan/phpstan-phpunit": "^1.0",
+                "phpstan/phpstan-strict-rules": "^1",
+                "phpstan/phpstan-symfony": "^1.1",
+                "symfony/phpunit-bridge": "^6.0"
             },
             "suggest": {
                 "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages",
@@ -626,7 +632,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-main": "2.2-dev"
+                    "dev-main": "2.3-dev"
                 }
             },
             "autoload": {
@@ -660,7 +666,7 @@
             "support": {
                 "irc": "ircs://irc.libera.chat:6697/composer",
                 "issues": "https://github.com/composer/composer/issues",
-                "source": "https://github.com/composer/composer/tree/2.2.9"
+                "source": "https://github.com/composer/composer/tree/2.3.0"
             },
             "funding": [
                 {
@@ -676,7 +682,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-03-15T21:13:37+00:00"
+            "time": "2022-03-30T09:15:36+00:00"
         },
         {
             "name": "composer/metadata-minifier",
@@ -822,30 +828,30 @@
         },
         {
             "name": "composer/pcre",
-            "version": "1.0.1",
+            "version": "3.0.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/composer/pcre.git",
-                "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560"
+                "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560",
-                "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560",
+                "url": "https://api.github.com/repos/composer/pcre/zipball/e300eb6c535192decd27a85bc72a9290f0d6b3bd",
+                "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd",
                 "shasum": ""
             },
             "require": {
-                "php": "^5.3.2 || ^7.0 || ^8.0"
+                "php": "^7.4 || ^8.0"
             },
             "require-dev": {
                 "phpstan/phpstan": "^1.3",
                 "phpstan/phpstan-strict-rules": "^1.1",
-                "symfony/phpunit-bridge": "^4.2 || ^5"
+                "symfony/phpunit-bridge": "^5"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-main": "1.x-dev"
+                    "dev-main": "3.x-dev"
                 }
             },
             "autoload": {
@@ -873,7 +879,7 @@
             ],
             "support": {
                 "issues": "https://github.com/composer/pcre/issues",
-                "source": "https://github.com/composer/pcre/tree/1.0.1"
+                "source": "https://github.com/composer/pcre/tree/3.0.0"
             },
             "funding": [
                 {
@@ -889,7 +895,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-01-21T20:24:37+00:00"
+            "time": "2022-02-25T20:21:48+00:00"
         },
         {
             "name": "composer/semver",
@@ -3045,32 +3051,32 @@
         },
         {
             "name": "react/promise",
-            "version": "v2.8.0",
+            "version": "v2.9.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/reactphp/promise.git",
-                "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4"
+                "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/reactphp/promise/zipball/f3cff96a19736714524ca0dd1d4130de73dbbbc4",
-                "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4",
+                "url": "https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910",
+                "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.4.0"
             },
             "require-dev": {
-                "phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36"
+                "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36"
             },
             "type": "library",
             "autoload": {
-                "psr-4": {
-                    "React\\Promise\\": "src/"
-                },
                 "files": [
                     "src/functions_include.php"
-                ]
+                ],
+                "psr-4": {
+                    "React\\Promise\\": "src/"
+                }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
@@ -3079,7 +3085,23 @@
             "authors": [
                 {
                     "name": "Jan Sorgalla",
-                    "email": "jsorgalla@gmail.com"
+                    "email": "jsorgalla@gmail.com",
+                    "homepage": "https://sorgalla.com/"
+                },
+                {
+                    "name": "Christian Lück",
+                    "email": "christian@clue.engineering",
+                    "homepage": "https://clue.engineering/"
+                },
+                {
+                    "name": "Cees-Jan Kiewiet",
+                    "email": "reactphp@ceesjankiewiet.nl",
+                    "homepage": "https://wyrihaximus.net/"
+                },
+                {
+                    "name": "Chris Boden",
+                    "email": "cboden@gmail.com",
+                    "homepage": "https://cboden.dev/"
                 }
             ],
             "description": "A lightweight implementation of CommonJS Promises/A for PHP",
@@ -3089,9 +3111,19 @@
             ],
             "support": {
                 "issues": "https://github.com/reactphp/promise/issues",
-                "source": "https://github.com/reactphp/promise/tree/v2.8.0"
+                "source": "https://github.com/reactphp/promise/tree/v2.9.0"
             },
-            "time": "2020-05-12T15:16:56+00:00"
+            "funding": [
+                {
+                    "url": "https://github.com/WyriHaximus",
+                    "type": "github"
+                },
+                {
+                    "url": "https://github.com/clue",
+                    "type": "github"
+                }
+            ],
+            "time": "2022-02-11T10:27:51+00:00"
         },
         {
             "name": "sebastian/cli-parser",
@@ -4122,16 +4154,16 @@
         },
         {
             "name": "seld/phar-utils",
-            "version": "1.1.2",
+            "version": "1.2.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/Seldaek/phar-utils.git",
-                "reference": "749042a2315705d2dfbbc59234dd9ceb22bf3ff0"
+                "reference": "9f3452c93ff423469c0d56450431562ca423dcee"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/749042a2315705d2dfbbc59234dd9ceb22bf3ff0",
-                "reference": "749042a2315705d2dfbbc59234dd9ceb22bf3ff0",
+                "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/9f3452c93ff423469c0d56450431562ca423dcee",
+                "reference": "9f3452c93ff423469c0d56450431562ca423dcee",
                 "shasum": ""
             },
             "require": {
@@ -4164,9 +4196,9 @@
             ],
             "support": {
                 "issues": "https://github.com/Seldaek/phar-utils/issues",
-                "source": "https://github.com/Seldaek/phar-utils/tree/1.1.2"
+                "source": "https://github.com/Seldaek/phar-utils/tree/1.2.0"
             },
-            "time": "2021-08-19T21:01:38+00:00"
+            "time": "2021-12-10T11:20:11+00:00"
         },
         {
             "name": "symfony/console",

From 96df1dfcb684374e2ef24b2db4ee9513d14da059 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=B6ller?= <am@localheinz.com>
Date: Wed, 30 Mar 2022 14:48:21 +0200
Subject: [PATCH 2/2] Fix: Conditions

---
 psalm-baseline.xml               | 15 +++------------
 src/Command/NormalizeCommand.php |  7 ++++++-
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index 36aff9e0..972c2c4d 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -1,20 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<files psalm-version="4.16.1@aa7e400908833b10c0333861f86cd48c510b60eb">
+<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
   <file src="src/Command/NormalizeCommand.php">
-    <MixedArgument occurrences="9">
-      <code>$composerFile</code>
-      <code>$composerFile</code>
-      <code>$composerFile</code>
-      <code>$composerFile</code>
-      <code>$composerFile</code>
-      <code>$composerFile</code>
-      <code>$composerFile</code>
-      <code>$composerFile</code>
-      <code>$composerFile</code>
-    </MixedArgument>
     <MixedAssignment occurrences="1">
       <code>$composerFile</code>
     </MixedAssignment>
+    <RedundantCondition occurrences="1"/>
+    <TypeDoesNotContainType occurrences="1"/>
   </file>
   <file src="test/Integration/Command/NormalizeCommand/AbstractTestCase.php">
     <MixedArrayAccess occurrences="1">
diff --git a/src/Command/NormalizeCommand.php b/src/Command/NormalizeCommand.php
index 507abbd6..f216e6b6 100644
--- a/src/Command/NormalizeCommand.php
+++ b/src/Command/NormalizeCommand.php
@@ -14,6 +14,7 @@
 namespace Ergebnis\Composer\Normalize\Command;
 
 use Composer\Command;
+use Composer\Composer;
 use Composer\Console\Application;
 use Composer\Factory;
 use Composer\IO;
@@ -132,7 +133,7 @@ protected function execute(
 
         $composerFile = $input->getArgument('file');
 
-        if (null === $composerFile) {
+        if (!\is_string($composerFile)) {
             $composerFile = Factory::getComposerFile();
         }
 
@@ -141,6 +142,10 @@ protected function execute(
             $composerFile,
         );
 
+        if (!$composer instanceof Composer) {
+            throw Exception\ShouldNotHappen::create();
+        }
+
         try {
             $indentFromExtra = self::indentFromExtra($composer->getPackage()->getExtra());
         } catch (\RuntimeException $exception) {