diff --git a/src/CompilingMatcher.php b/src/CompilingMatcher.php index 45bce70a..aea1d3b9 100644 --- a/src/CompilingMatcher.php +++ b/src/CompilingMatcher.php @@ -64,7 +64,7 @@ public static function clear() * @phpstan-param Constraint::OP_* $operator * @param string $version * - * @return mixed + * @return bool */ public static function match(ConstraintInterface $constraint, $operator, $version) { diff --git a/tests/VersionParserTest.php b/tests/VersionParserTest.php index 269a495a..b7856d94 100644 --- a/tests/VersionParserTest.php +++ b/tests/VersionParserTest.php @@ -197,7 +197,9 @@ public static function failingNormalizedVersions() */ public function testNormalizeFailsAndReportsAliasIssue($fullInput) { - preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $fullInput, $match); + if (!preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $fullInput, $match)) { + $this->fail($fullInput.' did not match the regex'); + } $parser = new VersionParser(); $parser->normalize($match[1], $fullInput); try { @@ -227,7 +229,9 @@ public static function failingNormalizedVersionsWithBadAlias() */ public function testNormalizeFailsAndReportsAliaseeIssue($fullInput) { - preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $fullInput, $match); + if (!preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $fullInput, $match)) { + $this->fail($fullInput.' did not match the regex'); + } $parser = new VersionParser(); try { $parser->normalize($match[1], $fullInput);