Thanks for taking the time to contribute. This document describes how to set up a development environment, run the test/quality suite locally, and submit changes.
git clone git@github.com:mmucklo/inflect.git
cd inflect
composer installRequires PHP 8.1+ for development. Release CI runs the full matrix (PHP 8.1 / 8.2 / 8.3 / 8.4).
vendor/bin/phpunit # tests
vendor/bin/phpstan analyse # static analysis (level 8)
vendor/bin/php-cs-fixer fix --dry-run # style check
vendor/bin/php-cs-fixer fix # apply style fixesAll four must pass before a PR can merge. CI runs PHPUnit on every PHP matrix leg and runs PHPStan + PHP-CS-Fixer on the 8.3 leg.
- Open a feature branch off
master. Do not commit directly tomaster. - Write tests. New inflections go in
singularizeProvider/pluralizeProviderintests/InflectTest.php. Edge cases (double-inflection guards, case preservation, uncountables) go inline as separate#[DataProvider]cases — see the existing patterns. - Keep PRs focused. One concern per PR. Roadmap items in
ROADMAP.mdare reasonable PR boundaries. - Open a PR against
master. Reference the roadmap section it addresses (e.g. "Addresses §7").
master— active development, PHP 8.1+.php5.3— back-port branch for critical fixes on the legacy PHP baseline. Do not land forward-looking work here. When a fix is applicable to both, cherry-pick to a siblingfoo-php5.3branch and open a second PR targetingphp5.3.
Short imperative subject line, then a blank line, then a paragraph or two of context. Explain why, not just what — the diff shows the what.
Adding a new irregular or regex rule has sharp edges — a rule that "works for the word I tested" often breaks an existing test. Before adding one:
- Confirm the word isn't already handled correctly by an existing regex.
- Test both directions: if you add
X → Yto$irregular,singularize('Y')andpluralize('X')must both round-trip, and unrelated words likeindiemust not accidentally match the suffix. - Add a test case with the input/expected in the appropriate provider.
File an issue with:
- PHP version (
php -v) - Package version (
composer show mmucklo/inflect) - The input that produced the wrong output, the output you got, and the output you expected
- A short snippet that reproduces (ideally a failing test case)
See ROADMAP.md for planned work. Items there are open for contribution — pick one, reply on the relevant issue or open a draft PR to start the conversation.