Skip to content

Conversation

@datamweb
Copy link
Contributor

@datamweb datamweb commented Dec 31, 2025

Description

These methods reduce cognitive load by removing the need to mentally parse isBefore(Time::now()) or isAfter(Time::now()). The method name describes exactly what state we are checking for, rather than how we are calculating it.

See : https://forum.codeigniter.com/showthread.php?tid=92487

$coupon = $couponModel->find($code);

if ($coupon->expires_at->isPast()) {
    echo 'This discount code has expired.';
}

if ($article->publish_at->isFuture()) {
    return view('coming_soon');
}

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@ddevsr ddevsr added the 4.7 label Dec 31, 2025
@ddevsr ddevsr requested a review from michalsn December 31, 2025 07:09
Copy link
Contributor

@neznaika0 neznaika0 left a comment

Choose a reason for hiding this comment

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

Good.

@paulbalandan paulbalandan added the enhancement PRs that improve existing functionalities label Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.7 enhancement PRs that improve existing functionalities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants