Skip to content

Commit

Permalink
accept PHP long version name
Browse files Browse the repository at this point in the history
  • Loading branch information
fain182 committed Jan 15, 2024
1 parent e8e41bc commit 73eae72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/CLI/TargetPhpVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TargetPhpVersion
private function __construct(string $version)
{
$versionNumbers = explode('.', $version);
if (3 == \count($versionNumbers)) {
if (3 <= \count($versionNumbers)) {
$version = $versionNumbers[0].'.'.$versionNumbers[1];
}

Expand Down
7 changes: 7 additions & 0 deletions tests/Unit/CLI/TargetPhpVersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ public function test_it_should_ignore_the_patch_number(): void
$this->assertEquals('8.3', $targetPhpVersion->get());
}

public function test_it_should_ignore_extra_informations(): void
{
$targetPhpVersion = TargetPhpVersion::create('7.3.33-14+ubuntu22.04.1+deb.sury.org+1');

$this->assertEquals('7.3', $targetPhpVersion->get());
}

public function test_it_should_throw_exception_if_not_valid_php_version(): void
{
$this->expectException(PhpVersionNotValidException::class);
Expand Down

0 comments on commit 73eae72

Please sign in to comment.