Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed version was wrongfully recognized as constraint #33

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tmp/*
!tmp/.keep
pnpm-lock.yaml
gha-creds-*.json
/coverage/

/vendor-bin/**/vendor/
/vendor-bin/**/composer.lock
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8-cli-alpine
FROM php:8.2-cli-alpine

RUN set -eux ; \
apk add --no-cache --virtual .composer-rundeps \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public function __construct()
{
$phpVersionRanges = [
'7.4.' => '33',
'8.0.' => '27',
'8.1.' => '17',
'8.0.' => '30',
'8.1.' => '28',
'8.2.' => (explode('.', phpversion()))[2],
];

Expand All @@ -36,7 +36,7 @@ public function __construct()
*/
public function extractActualPhpVersion(string $phpVersionConstraint): string
{
if (preg_match('/^(\d+)(\.\d)?(\.\d)?$/', $phpVersionConstraint, $matches)) {
if (preg_match('/^(\d+)(\.\d+)?(\.\d+)?$/', $phpVersionConstraint, $matches)) {
return $matches[1] . ($matches[2] ?? '.0') . ($matches[3] ?? '.0');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function extractVersionsDataProvider(): array
'version 8.0' => ['givenVersion' => '8.0.1', 'expectedVersion' => '8.0.1',],
'version 8.1' => ['givenVersion' => '^8.1', 'expectedVersion' => '8.1.0',],
'version 8.2' => ['givenVersion' => '8.2', 'expectedVersion' => '8.2.0',],
'version 10.23.24' => ['givenVersion' => '10.23.24', 'expectedVersion' => '10.23.24',],
'version 8.placeholder' => ['givenVersion' => '8.*', 'expectedVersion' => '8.0.0',],
];
}
Expand Down
Loading