Skip to content

refactor: convert dates with DateTimeImmutable::createFromInterface - #309

Merged
roxblnfk merged 1 commit into
2.xfrom
chore/psalm-7132
Nov 21, 2026
Merged

roxblnfk merged 1 commit into
2.xfrom
chore/psalm-7132

Conversation

@roxblnfk

Copy link
Copy Markdown
Member

What was changed

Driver::formatDatetime() converts the value with DateTimeImmutable::createFromInterface() instead of a match over the concrete classes. The output is unchanged; the psalm baseline drops the three entries that belonged to the removed arm.

Why?

Psalm 7.13.2 fails 2.x with NoValue on the default arm: no userland class can implement DateTimeInterface, so that arm never runs.

Checklist

  • Tested
    • Unit and SQLite suites run locally
    • Unit tests added

Psalm 7.13.2 reports the fallback arm as dead code: PHP lets no userland class implement DateTimeInterface, so every value is a DateTime or a DateTimeImmutable.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@roxblnfk
roxblnfk requested a review from a team November 21, 2026 11:17
@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.51%. Comparing base (fe58b51) to head (4ce6cfc).

Additional details and impacted files
@@            Coverage Diff             @@
##              2.x     #309      +/-   ##
==========================================
+ Coverage   92.50%   92.51%   +0.01%     
==========================================
  Files         143      143              
  Lines        5267     5263       -4     
==========================================
- Hits         4872     4869       -3     
+ Misses        395      394       -1     
Flag Coverage Δ
mysql 52.27% <100.00%> (-0.02%) ⬇️
postgres 58.94% <100.00%> (-0.02%) ⬇️
sqlite 50.36% <100.00%> (-0.02%) ⬇️
sqlserver 53.37% <100.00%> (-0.02%) ⬇️
unit 54.38% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roxblnfk
roxblnfk merged commit cf393e0 into 2.x Nov 21, 2026
25 checks passed
@roxblnfk
roxblnfk deleted the chore/psalm-7132 branch November 21, 2026 11:22
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.

1 participant