Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Sep 19, 2024
1 parent 6656025 commit 578f80e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/CompilingMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
8 changes: 6 additions & 2 deletions tests/VersionParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check failure on line 204 in tests/VersionParserTest.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ^7.5)

Offset 1 does not exist on array{}|array{string, non-empty-string, non-empty-string}.
try {
Expand Down Expand Up @@ -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);

Check failure on line 237 in tests/VersionParserTest.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ^7.5)

Offset 1 does not exist on array{}|array{string, non-empty-string, non-empty-string}.
Expand Down

0 comments on commit 578f80e

Please sign in to comment.