# Changelog

All notable changes to this project will be documented in this file.

This project aims to follow [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
and [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.2] - 2026-01-27

### Added
- Title mode: uppercase USPS state abbreviations in address-like input.

## [0.4.1] - 2026-01-26

### Added
- Overrides `[common]` section to apply entries to both title and name modes (with mode-specific overrides taking precedence).

## [0.4.0] - 2026-01-26

### Added
- `titleCase(string $input, bool $isName=false, string $encoding='UTF-8', ?Overrides $overrides=null)`.
- `nameCase(string $input, string $encoding='UTF-8', ?Overrides $overrides=null)`.

### Changed
- Note: `titleCase($input, true)` is equivalent to `nameCase($input)`.

### Breaking
- **BREAKING:** Removed `capitalize()`; use `titleCase()` / `nameCase()`.

## [0.3.1] - 2026-01-26

### Added
- Overrides file format using canonical entries (one preferred capitalization per line) under `[title]` and `[names]`.

### Changed
- Overrides lines trim leading/trailing whitespace and allow blank lines or comment lines (`#`/`;`).
- Phrase overrides take precedence over word overrides.

## [0.3.0] - 2026-01-26

### Changed
- Maintenance release with no user-facing behavior changes.

## [0.2.2] - 2026-01-26

### Fixed
- Treat URLs/domains/emails as opaque tokens that still count for word-position logic.
- Make minor-phrase lowercasing authoritative within interior phrases (e.g., `out of`, `up to`).
- Preserve acronym possessives while lowercasing the trailing `s` (e.g., `NASA's`).
- Normalize all-caps input so words are title-cased unless explicitly whitelisted.
- Add `MacV...` to the `Mac...` bi-capitalization allowlist.

## [0.2.1] - 2026-01-25

### Changed
- Updated README to reflect the latest changes.

## [0.2.0] - 2026-01-25

### Added
- Rule-driven configuration for **name** vs **title/address** modes (minor words, minor phrases, exception casing, segment handling).
- `mb_substr()`-aware `$substr` helper (with safe non-mb fallback) to support prefix-based logic cleanly.
- Support for additional token types:
  - **Dot-words** like `node.js`, `react.tsx` (left side title-cased; suffix kept lowercase, with an allowlist).
  - **Compounds** containing `&`, `/`, `+` such as `r&d`, `input/output`, `api+sdk`, `c++` (with conservative parsing).
- Dotted abbreviation allowlist for canonical casing (e.g., `ph.d.` → `Ph.D.`) while still uppercasing other dotted initialisms by default.
- “Compound skip” allowlist to preserve casing for special compound forms (e.g., `c/o`, `and/or`).
- Segment-aware title casing:
  - Detects segment starts after common delimiters (e.g., `:`, `—`, `–`, `?`, `!`) so minor words are capitalized when they begin a new segment.
  - Treats parenthetical starts as a segment restart in title mode (e.g., `(In Brief)`).
- Email-friendly title casing: keeps **“at”** lowercase when it introduces an email address.
- Title-mode lowercase overrides for common legal/versus forms (`vs`, and `v.`).
- Name-mode “bi-capitalization” support for common surname prefixes beyond `Mc…` (e.g., selective `Mac…`, `De…`, `Di…`, `Du…`, `La…`, `Le…`, `Van…` cases via configurable lists).
- Name-only fix for narrow apostrophe prefixes (e.g., `O'Connor`, `D'Artagnan`, `L'Enfant`) without affecting casual contractions like `y'all`.
- Apply minor-word casing within hyphenated compounds in title/address mode, preserving Unicode hyphen separators.

### Changed
- Expanded and refined the “minor words” lists:
  - **Names:** broadened particles/articles (e.g., `de/da/di/du/del/des`, `le/la`, `al/bin/ibn`, etc.).
  - **Titles:** expanded function words and added minor phrases (e.g., `out of`, `up to`).
- Roman numeral handling is stricter and more context-aware:
  - Title mode uses a tighter Roman numeral validator and only uppercases when the input looks intentionally lower/upper.
  - Name mode uppercases Roman numerals only for common suffix numerals (I–XX) and primarily when used as the last word.
  - Special-case guard to avoid incorrectly uppercasing `liv` at the start of a title.
- “Initialism-like” uppercasing heuristic in **name mode** is now gated by the *original input* looking initialism-y (all-caps, contains dots, or digits), reducing false positives (e.g., avoids `Ng Wei` → `NG Wei` when input is normal name casing).
- Token splitting for dotted initialisms was tightened to reduce accidental matches and better support canonical exceptions.

### Fixed
- Better preservation of intentional casing across more real-world token shapes (dot-words, compounds, and Unicode hyphen variants).
- More reliable minor-word capitalization around punctuation/section breaks in titles due to segment detection.

### Removed
- Hard-coded `MacD` / `MacV` regex replacements from the final per-word tweak pass (these are now handled via the more general bi-capitalization/prefix logic rather than bespoke substitutions).

## [0.1.0] - 2026-01-23

### Added
- Initial release.
- `RJT\TitleCase\capitalize()` for “smart” capitalization of titles/addresses and names.
- PHPUnit test suite with golden cases.
- PHPStan static analysis configuration.
- GitHub Actions CI workflow.
