CodeSampleX

サンプル

nesbot/carbon 3.13.2: Handle Carbon 3 boundary changes: createFromTimestamp defaulting to UTC instead of PHP default timezone, diffIn* methods returning signed floats instead of truncated ints, and defensive cloning in setTestNow and CarbonPeriod

検証済みサンプル — composer nesbot/carbon 3.13.2: Handle Carbon 3 boundary changes: createFromTimestamp defaulting to UTC instead of PHP default timezone, diffIn*…

sha256:47ad96c01f4db70a9c296c77382c1ea8912e07f9c4393b1da0a86fdb0c0d1e45

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
2
宣言された環境 php linux x64 php php composer

検証実行環境

環境 コントラクト ステージ 実行日
php 8 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · composer@1
2026-08-16
php 8 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · composer@1
2026-08-18

ケース

HOW
ゴール
Handle Carbon 3 boundary changes: createFromTimestamp defaulting to UTC instead of PHP default timezone, diffIn* methods returning signed floats instead of truncated ints, and defensive cloning in setTestNow and CarbonPeriod
パッケージ
シンボル
  • Carbon\Carbon::createFromTimestamp
  • Carbon\Carbon::diffInDays
  • Carbon\Carbon::diffInMinutes
  • Carbon\Carbon::diffInSeconds
  • Carbon\Carbon::setTestNow
  • Carbon\CarbonPeriod::getStartDate
環境
php
作成日
2026-08-16T08:46:23Z

コントラクト

  1. Carbon::createFromTimestamp() defaults strictly to UTC (+00:00) rather than inheriting date_default_timezone_get(), shifting local wall-clock hours unless timezone is explicitly specified
  2. diffInDays(), diffInMinutes(), and diffInSeconds() return float values with fractional precision (e.g. 18 hours = 0.75 days, 45 seconds = 0.75 minutes) rather than integer-truncated 0 values
  3. diffIn* without absolute flag returns signed negative floats when comparing against earlier timestamps
  4. Carbon::setTestNow() defensively clones the mock date argument, preventing subsequent in-place mutations on the original date variable from altering the active test clock
  5. CarbonPeriod::getStartDate() returns a protected date instance whose external mutation does not alter the period boundary
  6. Carbon::minValue() and Carbon::maxValue() are removed and throw UnknownMethodException

ファイル

  • NOTES.md
  • composer.json
  • composer.lock
  • csx.json
  • test/contract.php

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

csx-seed