Commit 4f91180
Register optional validator dependencies in the container
Several rules (Phone, Uuid, CountryCode, CurrencyCode, LanguageCode,
and SubdivisionCode) resolve their dependencies at runtime through
ContainerRegistry::getContainer(). With the Symfony container in place
of the default PHP-DI one, those lookups only succeed for services the
bundle explicitly defines, so creating any of these rules would throw
MissingComposerDependencyException even with the packages installed.
Define UuidFactory and the Sokil ISO-codes databases, each guarded by
class_exists() since the packages are optional. Register them with no
constructor arguments, which is what PHP-DI autowiring resolves to
upstream given that all their parameters are optional.
Mark them and the existing PhoneNumberUtil definition as public: the
validators call get()/has() on the compiled container from outside it,
and private services that nothing references are removed during
compilation, which made the Phone rule's has() check fail even when
libphonenumber was available.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 9275d98 commit 4f91180
1 file changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
56 | 75 | | |
57 | 76 | | |
58 | 77 | | |
| |||
0 commit comments