[web-php] master: Fix: Add return type declarations (#865)
| From: | Andreas Möller via GitHub | Date: | Wed, 06 Dec 2023 15:19:36 +0000 |
| Subject: | [web-php] master: Fix: Add return type declarations (#865) | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-31193@lists.php.net to get a copy of this message | ||
Author: Andreas Möller (localheinz)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2023-12-06T16:05:57+01:00
Commit: https://github.com/php/web-php/commit/786d1c5b2a7520801d6e07a8a1dd9161a5b6d862
Raw diff: https://github.com/php/web-php/commit/786d1c5b2a7520801d6e07a8a1dd9161a5b6d862.diff
Fix: Add return type declarations (#865)
Changed paths:
M images/supported-versions.php
M include/branches.inc
Diff:
diff --git a/images/supported-versions.php b/images/supported-versions.php
index e635372645..76b8147f20 100644
--- a/images/supported-versions.php
+++ b/images/supported-versions.php
@@ -27,12 +27,14 @@ function branches_to_show() {
return $branches;
}
-function min_date() {
+function min_date(): DateTime
+{
$now = new DateTime('January 1');
return $now->sub(new DateInterval('P3Y'));
}
-function max_date() {
+function max_date(): DateTime
+{
$now = new DateTime('January 1');
return $now->add(new DateInterval('P5Y'));
}
diff --git a/include/branches.inc b/include/branches.inc
index 5a2ac26d24..44d6f987a2 100644
--- a/include/branches.inc
+++ b/include/branches.inc
@@ -286,7 +286,8 @@ function get_final_release($branch) {
return null;
}
-function get_branch_bug_eol_date($branch) {
+function get_branch_bug_eol_date($branch): ?DateTime
+{
if (isset($GLOBALS['BRANCHES'][$branch]['stable'])) {
return new DateTime($GLOBALS['BRANCHES'][$branch]['stable']);
}
@@ -296,7 +297,8 @@ function get_branch_bug_eol_date($branch) {
return $date ? $date->add(new DateInterval('P2Y')) : null;
}
-function get_branch_security_eol_date($branch) {
+function get_branch_security_eol_date($branch): ?DateTime
+{
if (isset($GLOBALS['BRANCHES'][$branch]['security'])) {
return new DateTime($GLOBALS['BRANCHES'][$branch]['security']);
}
@@ -313,7 +315,8 @@ function get_branch_security_eol_date($branch) {
return $date ? $date->add(new DateInterval('P3Y')) : null;
}
-function get_branch_release_date($branch) {
+function get_branch_release_date($branch): ?DateTime
+{
$initial = get_initial_release($branch);
return $initial ? new DateTime($initial['date']) : null;