From 6be6ce7d9f911c248139976703b73f4876c8a38f Mon Sep 17 00:00:00 2001 From: Markus Staab <47448731+clxmstaab@users.noreply.github.com> Date: Wed, 2 Feb 2022 21:35:37 +0100 Subject: [PATCH] update composer/pcre to 1.0.1 (#10496) --- composer.lock | 14 +++++++------- src/Composer/Autoload/PhpFileCleaner.php | 6 +++--- .../IgnoreListPlatformRequirementFilter.php | 4 ++-- .../Package/Archiver/BaseExcludeFilter.php | 8 ++++---- src/Composer/Package/BasePackage.php | 8 ++++---- src/Composer/Plugin/PluginManager.php | 6 +++--- .../Question/StrictConfirmationQuestion.php | 8 ++++---- src/Composer/Repository/ComposerRepository.php | 2 +- src/Composer/Repository/FilterRepository.php | 6 +++++- tests/Composer/Test/Package/BasePackageTest.php | 2 +- 10 files changed, 34 insertions(+), 30 deletions(-) diff --git a/composer.lock b/composer.lock index 5cb60cb45..a0be49180 100644 --- a/composer.lock +++ b/composer.lock @@ -153,23 +153,23 @@ }, { "name": "composer/pcre", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "3d322d715c43a1ac36c7fe215fa59336265500f2" + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/3d322d715c43a1ac36c7fe215fa59336265500f2", - "reference": "3d322d715c43a1ac36c7fe215fa59336265500f2", + "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1", + "phpstan/phpstan": "^1.3", "phpstan/phpstan-strict-rules": "^1.1", "symfony/phpunit-bridge": "^4.2 || ^5" }, @@ -204,7 +204,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/1.0.0" + "source": "https://github.com/composer/pcre/tree/1.0.1" }, "funding": [ { @@ -220,7 +220,7 @@ "type": "tidelift" } ], - "time": "2021-12-06T15:17:27+00:00" + "time": "2022-01-21T20:24:37+00:00" }, { "name": "composer/semver", diff --git a/src/Composer/Autoload/PhpFileCleaner.php b/src/Composer/Autoload/PhpFileCleaner.php index 190d518a6..7941f463c 100644 --- a/src/Composer/Autoload/PhpFileCleaner.php +++ b/src/Composer/Autoload/PhpFileCleaner.php @@ -20,10 +20,10 @@ use Composer\Pcre\Preg; */ class PhpFileCleaner { - /** @var array */ + /** @var array */ private static $typeConfig; - /** @var string */ + /** @var non-empty-string */ private static $restPattern; /** @@ -266,7 +266,7 @@ class PhpFileCleaner } /** - * @param string $regex + * @param non-empty-string $regex * @param ?array $match * @return bool */ diff --git a/src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php b/src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php index 4e3ac7f58..d6d95a287 100644 --- a/src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php +++ b/src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php @@ -15,12 +15,12 @@ use Composer\Semver\Intervals; final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFilterInterface { /** - * @var string + * @var non-empty-string */ private $ignoreRegex; /** - * @var string + * @var non-empty-string */ private $ignoreUpperBoundRegex; diff --git a/src/Composer/Package/Archiver/BaseExcludeFilter.php b/src/Composer/Package/Archiver/BaseExcludeFilter.php index 74efd68f1..9a9c3b8c2 100644 --- a/src/Composer/Package/Archiver/BaseExcludeFilter.php +++ b/src/Composer/Package/Archiver/BaseExcludeFilter.php @@ -26,7 +26,7 @@ abstract class BaseExcludeFilter protected $sourcePath; /** - * @var array array of [$pattern, $negate, $stripLeadingSlash] arrays + * @var array array of [$pattern, $negate, $stripLeadingSlash] arrays */ protected $excludePatterns; @@ -78,7 +78,7 @@ abstract class BaseExcludeFilter * @param string[] $lines A set of lines to be parsed * @param callable $lineParser The parser to be used on each line * - * @return array Exclude patterns to be used in filter() + * @return array Exclude patterns to be used in filter() */ protected function parseLines(array $lines, $lineParser) { @@ -106,7 +106,7 @@ abstract class BaseExcludeFilter * * @param string[] $rules A list of exclude rules in gitignore syntax * - * @return array Exclude patterns + * @return array Exclude patterns */ protected function generatePatterns($rules) { @@ -123,7 +123,7 @@ abstract class BaseExcludeFilter * * @param string $rule An exclude rule in gitignore syntax * - * @return array{0: string, 1: bool, 2: bool} An exclude pattern + * @return array{0: non-empty-string, 1: bool, 2: bool} An exclude pattern */ protected function generatePattern($rule) { diff --git a/src/Composer/Package/BasePackage.php b/src/Composer/Package/BasePackage.php index 2a7a913a6..a3ec9c570 100644 --- a/src/Composer/Package/BasePackage.php +++ b/src/Composer/Package/BasePackage.php @@ -254,8 +254,8 @@ abstract class BasePackage implements PackageInterface * Build a regexp from a package name, expanding * globs as required * * @param string $allowPattern - * @param string $wrap Wrap the cleaned string by the given string - * @return string + * @param non-empty-string $wrap Wrap the cleaned string by the given string + * @return non-empty-string */ public static function packageNameToRegexp($allowPattern, $wrap = '{^%s$}i') { @@ -268,8 +268,8 @@ abstract class BasePackage implements PackageInterface * Build a regexp from package names, expanding * globs as required * * @param string[] $packageNames - * @param string $wrap - * @return string + * @param non-empty-string $wrap + * @return non-empty-string */ public static function packageNamesToRegexp(array $packageNames, $wrap = '{^(?:%s)$}iD') { diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index 0f0257752..c6073561b 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -55,12 +55,12 @@ class PluginManager protected $registeredPlugins = array(); /** - * @var array|null + * @var array|null */ private $allowPluginRules; /** - * @var array|null + * @var array|null */ private $allowGlobalPluginRules; @@ -643,7 +643,7 @@ class PluginManager /** * @param array|bool|null $allowPluginsConfig - * @return array|null + * @return array|null */ private function parseAllowedPlugins($allowPluginsConfig) { diff --git a/src/Composer/Question/StrictConfirmationQuestion.php b/src/Composer/Question/StrictConfirmationQuestion.php index fdd7fcf03..301bb91b0 100644 --- a/src/Composer/Question/StrictConfirmationQuestion.php +++ b/src/Composer/Question/StrictConfirmationQuestion.php @@ -25,9 +25,9 @@ use Symfony\Component\Console\Question\Question; */ class StrictConfirmationQuestion extends Question { - /** @var string */ + /** @var non-empty-string */ private $trueAnswerRegex; - /** @var string */ + /** @var non-empty-string */ private $falseAnswerRegex; /** @@ -35,8 +35,8 @@ class StrictConfirmationQuestion extends Question * * @param string $question The question to ask to the user * @param bool $default The default answer to return, true or false - * @param string $trueAnswerRegex A regex to match the "yes" answer - * @param string $falseAnswerRegex A regex to match the "no" answer + * @param non-empty-string $trueAnswerRegex A regex to match the "yes" answer + * @param non-empty-string $falseAnswerRegex A regex to match the "no" answer */ public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i') { diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index cbe7cb3f9..7d0bcab80 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -80,7 +80,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito protected $hasAvailablePackageList = false; /** @var ?array */ protected $availablePackages = null; - /** @var ?array */ + /** @var ?array */ protected $availablePackagePatterns = null; /** @var ?string */ protected $lazyProvidersUrl = null; diff --git a/src/Composer/Repository/FilterRepository.php b/src/Composer/Repository/FilterRepository.php index 0ee1ae53d..03fce779f 100644 --- a/src/Composer/Repository/FilterRepository.php +++ b/src/Composer/Repository/FilterRepository.php @@ -25,7 +25,7 @@ class FilterRepository implements RepositoryInterface { /** @var ?string */ private $only = null; - /** @var ?string */ + /** @var ?non-empty-string */ private $exclude = null; /** @var bool */ private $canonical = true; @@ -206,6 +206,10 @@ class FilterRepository implements RepositoryInterface return Preg::isMatch($this->only, $name); } + if ($this->exclude === null) { + return true; + } + return !Preg::isMatch($this->exclude, $name); } } diff --git a/tests/Composer/Test/Package/BasePackageTest.php b/tests/Composer/Test/Package/BasePackageTest.php index 7ecaa5de6..f95034d2b 100644 --- a/tests/Composer/Test/Package/BasePackageTest.php +++ b/tests/Composer/Test/Package/BasePackageTest.php @@ -95,7 +95,7 @@ class BasePackageTest extends TestCase /** * @param string[] $packageNames - * @param string $wrap + * @param non-empty-string $wrap * @param string $expectedRegexp * * @dataProvider dataPackageNamesToRegexp