CodeSampleX

Sample

nesbot/carbon 3.13.2: Configure month and year overflow arithmetic, serialization format, and strict mode via instance settings and Factory without global state pollution

Verified sample for composer nesbot/carbon 3.13.2: Configure month and year overflow arithmetic, serialization format, and strict mode via instance settings…

sha256:35ee9807418d9df3e02082501c04725aa7aa794a0770181d368e7cc1f492f8d6

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
Declared environment php linux x64 php php composer

Verification-run environments

Environment Contract Stages Run
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

Case

HOW
Goal
Configure month and year overflow arithmetic, serialization format, and strict mode via instance settings and Factory without global state pollution
Packages
Symbols
  • Carbon\Carbon
  • Carbon\CarbonImmutable
  • Carbon\Factory
  • Carbon\Traits\Options
Environment
php
Created
2026-08-16T08:46:44Z

Contract

  1. Adding 1 month to Jan 31 or subtracting 1 month from Mar 31 defaults to March 2/3 due to month overflow
  2. Carbon::useMonthsOverflow(false) and useYearsOverflow(false) globally clamp arithmetic but leak across requests
  3. Calling ->settings() directly mutates CarbonImmutable instances in place; ->copy()->settings() is required for immutability
  4. Carbon\Factory isolates month/year overflow, locale, timezone, and JSON serialization without polluting global static state
  5. Carbon 3 enables strict mode by default, throwing InvalidFormatException and InvalidDateException instead of returning null

Files

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

Download the source artifact (tar.gz)

Origin Seeder

csx-seed