Skip to content

Simplify now() to use new DateTimeImmutable('now', $utc) directly, avoiding costly microtime+createFromFormat roundtrip and locale-sensitive float formatting#8

Merged
gustavofreze merged 1 commit intomainfrom
feature/develop
Apr 21, 2026

Conversation

@gustavofreze
Copy link
Copy Markdown
Member

No description provided.

…y, avoiding costly microtime+createFromFormat roundtrip and locale-sensitive float formatting; remove unused MICROSECOND_FORMAT constant and redundant setTimezone call.
Copilot AI review requested due to automatic review settings April 21, 2026 22:59
@gustavofreze gustavofreze merged commit 2376601 into main Apr 21, 2026
8 checks passed
@gustavofreze gustavofreze deleted the feature/develop branch April 21, 2026 23:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes Instant::now() by constructing DateTimeImmutable('now', $utc) directly (removing the microtime()sprintf()createFromFormat() roundtrip), and updates repository/tooling metadata and contributor guidance.

Changes:

  • Simplify Instant::now() implementation and remove the no-longer-needed microsecond format constant.
  • Change timezone identifier validation to call DateTimeZone::listIdentifiers() directly (and remove the cached helper).
  • Refresh project tooling/config/docs (Composer config/scripts, Infection mutators, Makefile targets, repo dotfiles, and new .claude/ rule docs).

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Timezone.php Replaces cached identifier list with direct DateTimeZone::listIdentifiers() call and removes helper.
src/Instant.php Simplifies now() to new DateTimeImmutable('now', $utc); removes microsecond format constant.
infection.json.dist Changes disabled mutator from AssignCoalesce to ProtectedVisibility.
composer.json Updates package metadata, bumps dependencies, adds composer-normalize, reorganizes scripts/config.
README.md Updates overview wording to reflect library scope and immutability/value-object contract.
Makefile Runs composer normalize in configure, adds show-outdated, updates help output.
.gitignore Expands ignored IDE/agent artifacts; ignores composer.lock and coverage/build outputs.
.github/copilot-instructions.md Adds Copilot guidance pointing to .claude rules as source of truth.
.gitattributes Adds LF normalization and a clearer export-ignore list for Packagist tarballs.
.editorconfig Adds editor defaults (LF, trimming, indent rules, Makefile tabs).
.claude/rules/php-library-testing.md Adds PHPUnit + BDD Given/When/Then and strict coverage/mutation requirements.
.claude/rules/php-library-modeling.md Adds library architecture/modeling rules and public/internal API boundary guidance.
.claude/rules/php-library-documentation.md Adds README/documentation standards (TOC, badges, examples, FAQ, etc.).
.claude/rules/php-library-code-style.md Adds semantic PHP style rules (naming, comparisons, no else, etc.).
.claude/rules/github-workflows.md Adds workflow structure/security/style rules for GitHub Actions.
.claude/CLAUDE.md Adds project meta-guidance + required validation commands after changes.

Comment thread src/Timezone.php
Comment thread src/Timezone.php
Comment thread infection.json.dist
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