Skip to content

Commit

Permalink
Merge 52a24d9 into 1f04a53
Browse files Browse the repository at this point in the history
  • Loading branch information
vrestihnat committed Jan 31, 2021
2 parents 1f04a53 + 52a24d9 commit c1bfa4f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"require": {
"php": ">=7.1",
"kdyby/strict-objects": "^2.0",
"latte/latte": "^2.5.2 || ^3.0",
"latte/latte": "^2.5.2 <= 2.8.4",
"nette/caching": "^3.0",
"nette/di": "^3.0",
"nette/finder": "^2.5",
Expand Down
9 changes: 5 additions & 4 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 @@ -30,6 +31,7 @@
use Latte\Engine as LatteEngine;
use Nette\Application\Application;
use Nette\Bridges\ApplicationLatte\ILatteFactory;
use Nette\Bridges\ApplicationLatte\LatteFactory;
use Nette\Configurator;
use Nette\DI\Compiler;
use Nette\DI\Definitions\FactoryDefinition;
Expand All @@ -40,7 +42,6 @@
use Nette\Reflection\ClassType as ReflectionClassType;
use Nette\Schema\Expect;
use Nette\Schema\Schema;
use Nette\Utils\Callback;
use Nette\Utils\Finder;
use Nette\Utils\Validators;
use Symfony\Component\Translation\Extractor\ChainExtractor;
Expand Down Expand Up @@ -297,12 +298,12 @@ public function beforeCompile()
->addSetup('addFilter', ['translate', [$this->prefix('@helpers'), 'translateFilterAware']]);
};

$latteFactoryService = $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(), 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 @@ -372,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'], Callback::closure('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 c1bfa4f

Please sign in to comment.