[IT9PE1-30742] Add ItalianFiscalCode constraint, validator and provider - #97
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
1 similar comment
|
|
❌ The last analysis has failed. |
Contributor
Author
|
🤖 Review gate — 0 error / 1 warning / 1 info Human review needed: no — mechanical pattern copy of an established sibling (FrenchSiret Luhn delegation); the single warning is non-behavioral; can be merged without a peer review.
📋 Card audit: 6 done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Add the
ItalianFiscalCodeconstraint — the 11-digit numeric Codice Fiscale of Italian legal persons, which shares its format and Luhn check digit with the Partita IVA — following theFrenchSiretLuhn-delegation pattern:ItalianFiscalCodeextends Symfony'sLuhn(#[HasNamedArguments], default message);ItalianFiscalCodeValidatorextendsLuhnValidator: format failure (^\d{11}$) → ownWRONG_FORMAT_ERROR, checksum failure → inheritedLuhn::CHECKSUM_FAILED_ERROR.ItalianFiscalCodeProvider: maps theitalianFiscalCodeDBAL type (doctrine-types-bundle v2.18.0) to the constraint — autoconfigured, no DI change.Refs IT9PE1-30742
Test plan
ItalianFiscalCodeValidatorTest(sharedConstraintValidatorTestCase): 3 real Luhn-valid values (Adyen docs example + two public identifiers), 6 format-invalid cases (incl. the 16-char personal codice fiscale) and 1 checksum-invalid case assertingLuhn::CHECKSUM_FAILED_ERROR.ItalianFiscalCodeProviderTest:italianFiscalCodetype →[new ItalianFiscalCode()].vendor/bin/phpcs,vendor/bin/phpstan,vendor/bin/phpunit(332 tests) green in the open-source container, with doctrine-types-bundle v2.18.0 resolved from Packagist.Shipping
Merging this PR ships nothing: it needs a semver tag / GitHub release (v2.49.0, covering the DutchKvkNumber PR #96 too), then a
composer require assoconnect/validator-bundle:^2.49bump PR in the backend. Two reviews total.