Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Bug report
description: Report something that is not working as expected.
title: "[Bug]: "
labels:
- "type: bug"
- "status: needs triage"
Expand Down
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ updates:
- package-ecosystem: composer
directory: "/"
target-branch: develop
labels:
- "area: dependencies"
schedule:
interval: weekly
groups:
Expand All @@ -14,6 +16,8 @@ updates:
- package-ecosystem: github-actions
directory: "/"
target-branch: develop
labels:
- "area: dependencies"
schedule:
interval: weekly
groups:
Expand Down
290 changes: 193 additions & 97 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,118 +1,214 @@
name: Build

on:
'on':
push:
branches:
- '8.*.x'
- develop
- develop
- 8.*.x
paths-ignore:
- 'README.md'
- 'docs/**'

- README.md
- docs/**
pull_request:
branches:
- '8.*.x'
- develop

workflow_dispatch:

permissions:
contents: read

- develop
- 8.*.x
workflow_dispatch: null
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: build-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
jobs:
php:
name: Resolve PHP version
matrix:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.php.outputs.version }}

php: ${{ steps.php.outputs.versions }}
lowest: ${{ steps.php.outputs.lowest }}
steps:
- name: Checkout
uses: actions/checkout@v7

# Every branch declares exactly one PHP minor (">=8.N <8.N+1"), so the
# version comes from composer.json on any branch.
- name: Detect target PHP version
id: php
shell: bash
run: |
constraint="$(jq -r '.require.php' composer.json)"

if [[ ! "$constraint" =~ ^\>=(8\.[0-9]+) ]]; then
echo "Cannot read the target PHP minor from require.php: $constraint" >&2
exit 1
fi

echo "version=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"

check:
name: Check
needs: php
- name: Checkout
uses: actions/checkout@v7
- name: Read supported PHP minors
id: php
shell: bash
run: |
constraint="$(jq -r '.require.php' composer.json)"
if [[ ! "$constraint" =~ ^\>=8\.([0-9]+)\ \<8\.([0-9]+)$ ]] || (( BASH_REMATCH[2] != BASH_REMATCH[1] + 1 )); then
echo "require.php must declare exactly one PHP minor as >=8.N <8.N+1, got: $constraint" >&2
exit 1
fi
version="8.${BASH_REMATCH[1]}"
echo "versions=$(jq -cn --arg php "$version" '[$php]')" >> "$GITHUB_OUTPUT"
echo "lowest=$version" >> "$GITHUB_OUTPUT"
validate:
needs:
- matrix
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ needs.php.outputs.version }}
extensions: mbstring, intl
coverage: none
tools: composer:v2

- name: Install dependencies
uses: ramsey/composer-install@v4

- name: Check
run: composer check

- name: Checkout
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ needs.matrix.outputs.lowest }}
extensions: mbstring, intl
coverage: none
tools: composer:v2
- name: Install dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
with:
dependency-versions: highest
- name: Validate
run: composer validate --strict
style:
needs:
- matrix
- validate
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ needs.matrix.outputs.lowest }}
extensions: mbstring, intl
coverage: none
tools: composer:v2
- name: Install dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
with:
dependency-versions: highest
- name: Style
run: composer format:check
analyse:
needs:
- matrix
- style
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ needs.matrix.outputs.lowest }}
extensions: mbstring, intl
coverage: none
tools: composer:v2
- name: Install dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
with:
dependency-versions: highest
- name: Analyse
run: composer analyse
tests:
name: Tests - ${{ matrix.os }} - ${{ matrix.dependencies }}${{ matrix.intl && ' - intl' || '' }}
needs: php
runs-on: ${{ matrix.os }}

name: Tests - PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependencies }}${{ !matrix.intl && ' - without intl' || '' }}
needs:
- matrix
- analyse
strategy:
max-parallel: 2

fail-fast: false

fail-fast: true
matrix:
os:
- ubuntu-latest
- windows-latest
php: ${{ fromJSON(needs.matrix.outputs.php) }}
dependencies:
- lowest
- highest
- lowest
- highest
os:
- ubuntu-latest
- windows-latest
intl:
- true
- true
include:
# ext-intl is optional; the built-in formatters must work without it.
- os: ubuntu-latest
dependencies: highest
intl: false

# ext-intl is optional: the built-in formatters must work without it.
- php: ${{ needs.matrix.outputs.lowest }}
dependencies: highest
os: ubuntu-latest
intl: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ matrix.php }}
extensions: mbstring, ${{ matrix.intl && 'intl' || ':intl' }}
coverage: none
tools: composer:v2
- name: Install dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
with:
dependency-versions: ${{ matrix.dependencies }}
- name: Run tests
run: composer test
security:
needs:
- matrix
- tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ needs.matrix.outputs.lowest }}
extensions: mbstring, intl
coverage: none
tools: composer:v2
- name: Install dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
with:
dependency-versions: highest
- name: Security audit
run: composer security
archive:
needs:
- matrix
- security
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ needs.matrix.outputs.lowest }}
extensions: mbstring, intl
coverage: none
tools: composer:v2
- name: Install dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
with:
dependency-versions: highest
- name: Verify Composer archive
shell: bash
run: |
mkdir -p /tmp/pharaonic-ci-archive
composer archive --format=zip --dir=/tmp/pharaonic-ci-archive --file=package
unzip -t /tmp/pharaonic-ci-archive/package.zip
quality:
name: Quality gate
if: ${{ always() }}
needs:
- matrix
- validate
- style
- analyse
- tests
- security
- archive
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ needs.php.outputs.version }}
extensions: mbstring, ${{ matrix.intl && 'intl' || ':intl' }}
coverage: none
tools: composer:v2

- name: Install dependencies
uses: ramsey/composer-install@v4
with:
dependency-versions: ${{ matrix.dependencies }}

- name: Run tests
run: composer test
- name: Require every stage to succeed
env:
NEEDS_JSON: ${{ toJSON(needs) }}
run: |
python3 - <<'PY_CHECK'
import json, os, sys
results = json.loads(os.environ['NEEDS_JSON'])
failed = {name: job['result'] for name, job in results.items() if job['result'] != 'success'}
if failed:
print('Required stages did not succeed:', failed)
sys.exit(1)
print('Every required stage succeeded.')
PY_CHECK
2 changes: 1 addition & 1 deletion .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
# Creates and updates the labels in .github/labels.yml. Labels that are
# not listed are left alone.
- name: Sync labels
uses: crazy-max/ghaction-github-labeler@v5
uses: crazy-max/ghaction-github-labeler@548a7c3603594ec17c819e1239f281a3b801ab4d # v6.0.0
with:
yaml-file: .github/labels.yml
skip-delete: true
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project are documented in this file.

## 8.4.3 - Unreleased

### Fixed

- `Money::format()` with a `$locale` no longer prints a negative zero for currencies whose Intl fraction digits differ from ISO 4217: `Money::format(-0.4, 'IQD', locale: 'en_US')` returned `"-IQD 0"` and now returns `"IQD 0"`. The amount is compared with Intl's own formatted zero instead of being rounded with the ISO 4217 digits.

### Changed

- The internal `Support\Assert` and `Support\Excerpt` helpers moved to `Pharaonic\Readable`, and `Support\Intl` became `Pharaonic\Readable\Services\Integration\IntlService`. They stay `@internal` and are not part of the public API.
- The documentation has an upgrade guide.
- CI runs validation, style, static analysis, tests, the security audit and an archive check in order, behind one quality gate.

## 8.4.2 - 2026-10-11

### Fixed
Expand Down
4 changes: 3 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Our standards

Be respectful, constructive, and focused on the technical work. Harassment, discrimination, personal attacks, and intentionally disruptive behavior are not acceptable.
Be respectful, constructive, and focused on the technical work. Respect other people's privacy and never publish their private information. Harassment, discrimination, personal attacks, and intentionally disruptive behavior are not acceptable.

## Scope

Expand All @@ -11,3 +11,5 @@ This code of conduct applies to repository discussions, issues, pull requests, r
## Enforcement

Project maintainers may edit, remove, or reject contributions and participation that violate these standards.

Report conduct concerns privately to the maintainers rather than in public threads.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ git remote add upstream https://github.com/Pharaonic/php-readable.git

## Choose the target branch

Check out the branch that matches the PHP version you are targeting:
Check out the branch that matches the PHP version you are targeting. For a bug fix, use the oldest line that has the bug:

```bash
git checkout 8.4.x
Expand Down Expand Up @@ -87,7 +87,7 @@ All checks must pass. CI also runs the tests with the lowest allowed dependency
git push origin fix/compact-rounding
```

Open the pull request against the version branch you started from, and fill in the pull request template. Do not submit the same change to multiple version branches unless asked to.
Open the pull request against the version branch you started from, and fill in the pull request template. Maintainers port fixes from the oldest affected line to the newer lines, so do not submit the same change to several branches.

## Code of Conduct

Expand Down
Loading