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

Fix: Do not pass null to function that expects DateTime or string #869

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

localheinz
Copy link
Contributor

@localheinz localheinz commented Dec 6, 2023

This pull request

  • stops passing null to a function that expects DateTime or string

Follows #847.

πŸ’β€β™‚οΈ Running

git grep -i format_interval

on current master yields

eol.php:51:				<?php $eolPeriod = format_interval($eolDate, null) ?>
include/branches.inc:46:function format_interval($from, $to) {
supported-versions.php:66:					<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($initial, null)) ?></em></td>
supported-versions.php:68:					<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($until, null)) ?></em></td>
supported-versions.php:70:					<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($eol, null)) ?></em></td>

Before

See http://localhost:8080/supported-versions.php:

CleanShot 2023-12-06 at 17 02 22@2x

After

See http://localhost:8080/supported-versions.php:

CleanShot 2023-12-06 at 17 02 28@2x

@@ -43,11 +43,10 @@ $BRANCHES = [
* page. (Currently 28 days.) */
$KEEP_EOL = new DateInterval('P28D');

function format_interval($from, $to) {
function format_interval($from, DateTime $to) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could create $to in the function, but that would make it harder to test if we wanted to test it.

@kamil-tekiela kamil-tekiela merged commit 2b70836 into php:master Dec 6, 2023
2 checks passed
@localheinz localheinz deleted the fix/now branch December 6, 2023 16:47
@localheinz
Copy link
Contributor Author

Thank you, @kamil-tekiela!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants