From 18246212db7103d0a2688febcc336f77183275ee Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 26 Feb 2022 14:02:11 +0100 Subject: [PATCH] Upgrade to composer/pcre 2.x --- composer.json | 4 +-- composer.lock | 34 +++++++++---------- src/Composer/Autoload/ClassMapGenerator.php | 2 +- src/Composer/Json/JsonManipulator.php | 1 + .../Package/Loader/RootPackageLoader.php | 6 ++-- src/Composer/Repository/Vcs/GitLabDriver.php | 10 +++--- 6 files changed, 29 insertions(+), 28 deletions(-) diff --git a/composer.json b/composer.json index 98fe72ab9..80b97d6ad 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "composer/metadata-minifier": "^1.0", "composer/semver": "^3.0", "composer/spdx-licenses": "^1.2", - "composer/xdebug-handler": "^2 || ^3.0.1", + "composer/xdebug-handler": "^2.0.2 || ^3.0.3", "justinrainbow/json-schema": "^5.2.11", "psr/log": "^1.0 || ^2.0 || ^3.0", "seld/jsonlint": "^1.4", @@ -37,7 +37,7 @@ "symfony/finder": "^5.4 || ^6.0", "symfony/process": "^5.4 || ^6.0", "react/promise": "^2.8", - "composer/pcre": "^1.0", + "composer/pcre": "^2 || ^3", "symfony/polyfill-php73": "^1.24", "symfony/polyfill-php80": "^1.24" }, diff --git a/composer.lock b/composer.lock index 18905377e..46984de0e 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": "03b82664ef6f80651118f0c06a49280c", + "content-hash": "3a7c7da73f59287030b9704930778e2b", "packages": [ { "name": "composer/ca-bundle", @@ -153,30 +153,30 @@ }, { "name": "composer/pcre", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" + "reference": "c8e9d27cfc5ed22643c19c160455b473ffd8aabe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", - "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "url": "https://api.github.com/repos/composer/pcre/zipball/c8e9d27cfc5ed22643c19c160455b473ffd8aabe", + "reference": "c8e9d27cfc5ed22643c19c160455b473ffd8aabe", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" + "php": "^7.2 || ^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": "2.x-dev" } }, "autoload": { @@ -204,7 +204,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/2.0.0" }, "funding": [ { @@ -220,7 +220,7 @@ "type": "tidelift" } ], - "time": "2022-01-21T20:24:37+00:00" + "time": "2022-02-25T20:05:29+00:00" }, { "name": "composer/semver", @@ -385,20 +385,20 @@ }, { "name": "composer/xdebug-handler", - "version": "3.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "b11b961ef6b11e380e81a20b27c8cad54eeefe61" + "reference": "ced299686f41dce890debac69273b47ffe98a40c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/b11b961ef6b11e380e81a20b27c8cad54eeefe61", - "reference": "b11b961ef6b11e380e81a20b27c8cad54eeefe61", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", + "reference": "ced299686f41dce890debac69273b47ffe98a40c", "shasum": "" }, "require": { - "composer/pcre": "^1", + "composer/pcre": "^1 || ^2 || ^3", "php": "^7.2.5 || ^8.0", "psr/log": "^1 || ^2 || ^3" }, @@ -431,7 +431,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/3.0.2" + "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" }, "funding": [ { @@ -447,7 +447,7 @@ "type": "tidelift" } ], - "time": "2022-02-24T20:53:32+00:00" + "time": "2022-02-25T21:32:43+00:00" }, { "name": "justinrainbow/json-schema", diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index fa687d101..bc9e0ec95 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -263,7 +263,7 @@ class ClassMapGenerator for ($i = 0, $len = count($matches['type']); $i < $len; $i++) { if (!empty($matches['ns'][$i])) { - $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\'; + $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', (string) $matches['nsname'][$i]) . '\\'; } else { $name = $matches['name'][$i]; // skip anon classes extending/implementing diff --git a/src/Composer/Json/JsonManipulator.php b/src/Composer/Json/JsonManipulator.php index 96a188d16..9d9792cfe 100644 --- a/src/Composer/Json/JsonManipulator.php +++ b/src/Composer/Json/JsonManipulator.php @@ -431,6 +431,7 @@ class JsonManipulator } // no child data left, $name was the only key in + unset($match); Preg::match('#^{ \s*? (?P\S+.*?)? (?P\s*) }$#sx', $childrenClean, $match); if (empty($match['content'])) { $newline = $this->newline; diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index c4c345065..211a23c87 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -240,7 +240,7 @@ class RootPackageLoader extends ArrayLoader } // parse explicit stability flags to the most unstable - $match = false; + $matched = false; foreach ($constraints as $constraint) { if (Preg::isMatch('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) { $name = strtolower($reqName); @@ -250,11 +250,11 @@ class RootPackageLoader extends ArrayLoader continue; } $stabilityFlags[$name] = $stability; - $match = true; + $matched = true; } } - if ($match) { + if ($matched) { continue; } diff --git a/src/Composer/Repository/Vcs/GitLabDriver.php b/src/Composer/Repository/Vcs/GitLabDriver.php index d80157f37..bb4db239c 100644 --- a/src/Composer/Repository/Vcs/GitLabDriver.php +++ b/src/Composer/Repository/Vcs/GitLabDriver.php @@ -620,26 +620,26 @@ class GitLabDriver extends VcsDriver * * @return string|false */ - private static function determineOrigin(array $configuredDomains, string $guessedDomain, array &$urlParts, string $portNumber) + private static function determineOrigin(array $configuredDomains, string $guessedDomain, array &$urlParts, ?string $portNumber) { $guessedDomain = strtolower($guessedDomain); - if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) { - if ($portNumber) { + if (in_array($guessedDomain, $configuredDomains) || (null !== $portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) { + if (null !== $portNumber) { return $guessedDomain.':'.$portNumber; } return $guessedDomain; } - if ($portNumber) { + if (null !== $portNumber) { $guessedDomain .= ':'.$portNumber; } while (null !== ($part = array_shift($urlParts))) { $guessedDomain .= '/' . $part; - if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array(Preg::replace('{:\d+}', '', $guessedDomain), $configuredDomains))) { + if (in_array($guessedDomain, $configuredDomains) || (null !== $portNumber && in_array(Preg::replace('{:\d+}', '', $guessedDomain), $configuredDomains))) { return $guessedDomain; } }