Contributing
Thank you for your interest in contributing to Numerik!
Development setup
Section titled “Development setup”-
Fork and clone
Terminal window git clone https://github.com/sqrcz/numerik.gitcd numerik -
Install PHP dependencies
Terminal window composer install -
Run the test suite
Terminal window composer test
Local checks
Section titled “Local checks”| Command | What it runs |
|---|---|
composer test | PHPUnit test suite |
composer test:cover | PHPUnit with HTML + Clover coverage reports |
composer stan | PHPStan at level 10 |
composer cs-fix | PHP CS Fixer — auto-fix |
composer cs-check | PHP CS Fixer — check only (used in CI) |
composer mutation | Infection mutation testing |
composer check | cs-check + stan + test in sequence |
Run composer check before opening a PR to catch all issues locally.
Adding a new identifier
Section titled “Adding a new identifier”Adding a new identifier (e.g. Dowód Osobisty, IBAN PL) requires touching several files. Work through this checklist:
- Create
src/ValueObjects/NewIdentifier.php(readonly class implementingIdentifierInterface) - Create
src/Identifiers/NewIdentifierIdentifier.php(implements bothValidatorInterfaceandParserInterface; acceptsbool $strict = true) - Add new
ValidationFailureReasoncases if the identifier introduces new failure types - Add a factory method to
src/Numerik.php(Numerik::newIdentifier(bool $strict = true)) - Add
tests/Fixtures/new_identifier_valid.txtandnew_identifier_invalid.txt - Add unit tests for the validator, parser, and value object
- Add an identifier page under
docs/src/content/docs/identifiers/ - Update
CHANGELOG.md
Commit style
Section titled “Commit style”Use Conventional Commits:
feat: add Dowód Osobisty validationfix: correct PESEL checksum for 2100s birth datesdocs: update REGON algorithm descriptiontest: add NIP fixtures for invalid tax office codeschore: update PHPStan to 2.xTypes: feat, fix, docs, test, refactor, chore, ci.
Pull request process
Section titled “Pull request process”- Create a branch from
main(e.g.feature/dowod-osobisty). - Make your changes.
- Ensure
composer checkpasses. - Open a PR against
mainand fill in the template.
Reporting a bug
Section titled “Reporting a bug”Use the Bug Report template on GitHub.
Security vulnerabilities
Section titled “Security vulnerabilities”Do not open a public issue. Report via GitHub’s private advisory system. See SECURITY.md.
If this saved you time → ☕ Buy me a coffee