From b13ea678668c4475a30dd18bd9834d901e38c478 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 11 Jul 2024 10:44:31 +0200 Subject: [PATCH] Fix some new failures --- composer.json | 2 +- phpstan-baseline.neon | 5 ----- src/Preg.php | 7 ++++++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 13991bd..8e78c8c 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "php": "^7.2 || ^8.0" }, "require-dev": { - "symfony/phpunit-bridge": "^5", + "symfony/phpunit-bridge": "^7", "phpstan/phpstan": "^1.3", "phpstan/phpstan-strict-rules": "^1.1" }, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index cab5dde..b38221e 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -24,8 +24,3 @@ parameters: message: "#^Parameter &\\$matches @param\\-out type of method Composer\\\\Pcre\\\\Preg\\:\\:matchWithOffsets\\(\\) expects array\\\\}\\>, array\\ given\\.$#" count: 1 path: src/Preg.php - - - - message: "#^Parameter &\\$matches @param\\-out type of method Composer\\\\Pcre\\\\Preg\\:\\:pregMatch\\(\\) expects array\\\\}\\|string\\|null\\>, array given\\.$#" - count: 1 - path: src/Preg.php diff --git a/src/Preg.php b/src/Preg.php index 5794f26..dd4df19 100644 --- a/src/Preg.php +++ b/src/Preg.php @@ -445,7 +445,12 @@ private static function pregMatch(string $pattern, string $subject, ?array &$mat if ($result === 0) { $matches = []; } else { - $matches = array_map(function ($m) { return reset($m); }, $matchesInternal); + /** @var array}>>|array> $matchesInternal */ + $matches = array_map(function (array $m) { + $first = reset($m); + assert($first !== false); + return $first; + }, $matchesInternal); $result = min($result, 1); }