Skip to content

Commit

Permalink
Merge pull request Kdyby#176 from mikoczy/removed_null_locale
Browse files Browse the repository at this point in the history
  • Loading branch information
enumag authored Oct 14, 2020
2 parents 0619a64 + e70d55c commit 2bc453b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ php:
- 7.1
- 7.2
- 7.3
- 7.4

env:
- # dev
- DEV=1
- COMPOSER_EXTRA_ARGS="--prefer-stable"
- COMPOSER_EXTRA_ARGS="--prefer-lowest --prefer-stable"

Expand All @@ -28,8 +29,10 @@ matrix:
exclude:
- php: 7.3
env: COMPOSER_EXTRA_ARGS="--prefer-stable"
- php: 7.4
env: COMPOSER_EXTRA_ARGS="--prefer-lowest --prefer-stable"
allow_failures:
- env:
- env: DEV=1

install:
- if [ "$CODING_STANDARD" = "1" ]; then composer require --dev --no-update kdyby/coding-standard:^1.0@dev; fi
Expand Down
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
parameters:
ignoreErrors:
- '#Constant TEMP_DIR not found#'
# Temporary, untill the resolvers are refactored to work on application request basis
- '#Strict comparison using === between string and null will always evaluate to false#'
# Optional arguments
- "#Casting to string something that's already string#"
- "#Casting to int something that's already int#"
Expand Down
2 changes: 1 addition & 1 deletion src/LocaleResolver/LocaleParamResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function onRequest(Application $sender, Request $request)
return;
}

$this->translator->setLocale(NULL);
$this->translator->setLocale('');
$this->translator->getLocale(); // invoke resolver
}

Expand Down
3 changes: 1 addition & 2 deletions src/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public function __construct(
$this->translationsLoader = $loader;

parent::__construct('', $formatter);
$this->setLocale(NULL);
}

/**
Expand Down Expand Up @@ -349,7 +348,7 @@ public function setLocale($locale)
*/
public function getLocale()
{
if (parent::getLocale() === NULL) {
if (empty(parent::getLocale())) {
$this->setLocale($this->localeResolver->resolve($this));
}

Expand Down
1 change: 1 addition & 0 deletions tests/php.ini-unix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
memory_limit = 256M

0 comments on commit 2bc453b

Please sign in to comment.