Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntlExtension > Return empty string when input is null #3268

Merged
merged 1 commit into from Feb 13, 2020

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented Feb 13, 2020

{{ inputCountry | country_name('en') }}

When inputCountry is null it will give this error:

Argument 1 passed to Twig\Extra\Intl\IntlExtension::getCountryName() must be of the type string, null given

With this change, an empty string will be returned instead.

See discussion in #3257 (comment)

@ruudk ruudk changed the title IntlExtension > Return empty string in null input IntlExtension > Return empty string when input is null Feb 13, 2020
@ruudk ruudk force-pushed the return-empty-string-on-null-input branch from d52e3c9 to f3c4595 Compare February 13, 2020 13:18
@fabpot fabpot changed the base branch from 3.x to 2.x February 13, 2020 13:23
@fabpot fabpot force-pushed the return-empty-string-on-null-input branch from f3c4595 to caecd2a Compare February 13, 2020 13:24
@fabpot
Copy link
Contributor

fabpot commented Feb 13, 2020

Thank you @ruudk.

fabpot added a commit that referenced this pull request Feb 13, 2020
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.

Discussion
----------

IntlExtension > Return empty string when input is null

```twig
{{ inputCountry | country_name('en') }}
```
When `inputCountry` is `null` it will give this error:
```
Argument 1 passed to Twig\Extra\Intl\IntlExtension::getCountryName() must be of the type string, null given
```

With this change, an empty string will be returned instead.

See discussion in #3257 (comment)

Commits
-------

caecd2a IntlExtension > Return empty string when input is null
@fabpot fabpot merged commit caecd2a into twigphp:2.x Feb 13, 2020
@ruudk ruudk deleted the return-empty-string-on-null-input branch February 13, 2020 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants