Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit 50cb6dc

Browse files
committed
Fix date extraction.
1 parent 7f0e9a8 commit 50cb6dc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/PhpVersionFetcher.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function eol(): iterable
7575
$cols = (new Crawler($row))->filter('td');
7676

7777
$version = $cols->eq(0)->text();
78-
$endOfLife = new DateTimeImmutable($cols->eq(1)->text());
78+
$endOfLife = $this->extractDate($cols->eq(1)->text());
7979
$lastRelease = $cols->eq(3)->text();
8080

8181
$initialVersion = "3.0" !== $version ? "$version.0" : "$version.x";
@@ -141,4 +141,11 @@ public function releases(): iterable
141141

142142
return $releases;
143143
}
144+
145+
private function extractDate(string $str): DateTimeImmutable
146+
{
147+
$date = substr($str, 0, strpos($str, '(') ?? strlen($str));
148+
149+
return new DateTimeImmutable($date);
150+
}
144151
}

0 commit comments

Comments
 (0)