Skip to content

Commit 6a86855

Browse files
authored
Merge pull request misd-service-development#201 from odolbeau/support-phone-number-format-as-string
Remove deprecations notice + update doc
2 parents 538f752 + 4207836 commit 6a86855

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ The `phone_number_format` filter can be used to format a phone number object. A
108108

109109
For example, to format an object called `myPhoneNumber` in the `libphonenumber\PhoneNumberFormat::NATIONAL` format:
110110

111-
```php
111+
```twig
112112
{{ myPhoneNumber|phone_number_format('NATIONAL') }}
113+
{# or #}
114+
{{ myPhoneNumber|phone_number_format(enum('libphonenumber\PhoneNumberFormat').NATIONAL) }}
113115
```
114116

115117
By default phone numbers are formatted in the `libphonenumber\PhoneNumberFormat::INTERNATIONAL` format.
@@ -120,7 +122,7 @@ The `phone_number_of_type` test can be used to check a phone number against a ty
120122

121123
For example, to check if an object called `myPhoneNumber` is a `libphonenumber\PhoneNumberType::MOBILE` type:
122124

123-
```php
125+
```twig
124126
{% if myPhoneNumber is phone_number_of_type('MOBILE') }} %} ... {% endif %}
125127
```
126128

@@ -240,7 +242,7 @@ public function getCountryCode()
240242
}
241243
```
242244

243-
By default any valid phone number will be accepted. You can restrict the type through the `type` property, recognised values:
245+
By default, any valid phone number will be accepted. You can restrict the type through the `type` property, recognised values:
244246

245247
- `Misd\PhoneNumberBundle\Validator\Constraints\PhoneNumber::ANY` (default)
246248
- `Misd\PhoneNumberBundle\Validator\Constraints\PhoneNumber::FIXED_LINE`

src/Templating/Helper/PhoneNumberHelper.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ public function format(PhoneNumber|string $phoneNumber, string|int|PhoneNumberFo
3535
$phoneNumber = $this->getPhoneNumber($phoneNumber);
3636

3737
if (true === \is_string($format)) {
38-
trigger_deprecation('odolbeau/phone-number-bundle', '4.2', 'Passing a string to the "format" parameter is deprecated, pass a libphonenumber\PhoneNumberFormat instance instead.');
39-
4038
$constant = '\libphonenumber\PhoneNumberFormat::'.$format;
4139
if (false === \defined($constant)) {
4240
throw new InvalidArgumentException('The format must be either a constant value or name in libphonenumber\PhoneNumberFormat');

0 commit comments

Comments
 (0)