Skip to content

Commit b13ea67

Browse files
committed
Fix some new failures
1 parent 540af38 commit b13ea67

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"php": "^7.2 || ^8.0"
2121
},
2222
"require-dev": {
23-
"symfony/phpunit-bridge": "^5",
23+
"symfony/phpunit-bridge": "^7",
2424
"phpstan/phpstan": "^1.3",
2525
"phpstan/phpstan-strict-rules": "^1.1"
2626
},

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,3 @@ parameters:
2424
message: "#^Parameter &\\$matches @param\\-out type of method Composer\\\\Pcre\\\\Preg\\:\\:matchWithOffsets\\(\\) expects array\\<int\\|string, array\\{string\\|null, int\\<\\-1, max\\>\\}\\>, array\\<int\\|string, string\\|null\\> given\\.$#"
2525
count: 1
2626
path: src/Preg.php
27-
28-
-
29-
message: "#^Parameter &\\$matches @param\\-out type of method Composer\\\\Pcre\\\\Preg\\:\\:pregMatch\\(\\) expects array\\<int\\|string, array\\{string\\|null, int\\<\\-1, max\\>\\}\\|string\\|null\\>, array given\\.$#"
30-
count: 1
31-
path: src/Preg.php

src/Preg.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,12 @@ private static function pregMatch(string $pattern, string $subject, ?array &$mat
445445
if ($result === 0) {
446446
$matches = [];
447447
} else {
448-
$matches = array_map(function ($m) { return reset($m); }, $matchesInternal);
448+
/** @var array<int|string, array<array{string|null, int<-1, max>}>>|array<int|string, array<string|null>> $matchesInternal */
449+
$matches = array_map(function (array $m) {
450+
$first = reset($m);
451+
assert($first !== false);
452+
return $first;
453+
}, $matchesInternal);
449454
$result = min($result, 1);
450455
}
451456

0 commit comments

Comments
 (0)