Skip to content

Commit

Permalink
fix cs
Browse files Browse the repository at this point in the history
  • Loading branch information
vrestihnat committed Jan 31, 2021
1 parent 571f093 commit 52a24d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ matrix:
env: COMPOSER_EXTRA_ARGS="--prefer-stable" PHPSTAN=1
- php: 7.3
env: COMPOSER_EXTRA_ARGS="--prefer-stable" CODING_STANDARD=1
- php: 7.4
env: COMPOSER_EXTRA_ARGS="--prefer-stable" CODING_STANDARD=1
exclude:
- php: 7.3
env: COMPOSER_EXTRA_ARGS="--prefer-stable"
env: COMPOSER_EXTRA_ARGS="--prefer-stable"
- php: 7.4
env: COMPOSER_EXTRA_ARGS="--prefer-lowest --prefer-stable"
env: COMPOSER_EXTRA_ARGS="--prefer-lowest --prefer-stable"
allow_failures:
- env: DEV=1

Expand Down
13 changes: 5 additions & 8 deletions src/DI/TranslationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Kdyby\Translation\DI;

use Closure;
use Kdyby\Console\DI\ConsoleExtension;
use Kdyby\Monolog\Logger as KdybyLogger;
use Kdyby\Translation\Caching\PhpFileStorage;
Expand All @@ -29,8 +30,8 @@
use Kdyby\Translation\Translator as KdybyTranslator;
use Latte\Engine as LatteEngine;
use Nette\Application\Application;
use Nette\Bridges\ApplicationLatte\LatteFactory;
use Nette\Bridges\ApplicationLatte\ILatteFactory;
use Nette\Bridges\ApplicationLatte\LatteFactory;
use Nette\Configurator;
use Nette\DI\Compiler;
use Nette\DI\Definitions\FactoryDefinition;
Expand Down Expand Up @@ -297,16 +298,12 @@ public function beforeCompile()
->addSetup('addFilter', ['translate', [$this->prefix('@helpers'), 'translateFilterAware']]);
};

$latteFactoryService = $builder->getByType(LatteFactory::class)?: $builder->getByType(ILatteFactory::class) ;
$latteFactoryService = $builder->getByType(LatteFactory::class)?: $builder->getByType(ILatteFactory::class);
if (!$latteFactoryService || !self::isOfType($builder->getDefinition($latteFactoryService)->getClass(), LatteEngine::class)) {
$latteFactoryService = 'nette.latteFactory';
}

if ($builder->hasDefinition($latteFactoryService)
&& (self::isOfType($builder->getDefinition($latteFactoryService)->getClass(), LatteFactory::class)
|| self::isOfType($builder->getDefinition($latteFactoryService)->getClass(), ILatteFactory::class))
)
{
if ($builder->hasDefinition($latteFactoryService) && (self::isOfType($builder->getDefinition($latteFactoryService)->getClass(), LatteFactory::class) || self::isOfType($builder->getDefinition($latteFactoryService)->getClass(), ILatteFactory::class))) {
$registerToLatte($builder->getDefinition($latteFactoryService));
}

Expand Down Expand Up @@ -376,7 +373,7 @@ public function beforeCompile()
return str_replace((DIRECTORY_SEPARATOR === '/') ? '\\' : '/', DIRECTORY_SEPARATOR, Helpers::expand($dir, $builder->parameters));
}, $config['dirs']);

$dirs = array_values(array_filter($config['dirs'], \Closure::fromCallable('is_dir')));
$dirs = array_values(array_filter($config['dirs'], Closure::fromCallable('is_dir')));
if (count($dirs) > 0) {
foreach ($dirs as $dir) {
$builder->addDependency($dir);
Expand Down

0 comments on commit 52a24d9

Please sign in to comment.