Skip to content

Commit

Permalink
Symfony 4.2 depreciation fixes (#263)
Browse files Browse the repository at this point in the history
* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Fixed deprecation messages in Symfony 4.2

* Revert .travis.yml in scope of "Fixed deprecation messages in Symfony 4.2"

This reverts commit 32a4628.
  • Loading branch information
romantymoshyk authored and monteiro committed Dec 8, 2019
1 parent 7418f54 commit 3baf98d
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 3 deletions.
13 changes: 10 additions & 3 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$builder = new TreeBuilder();
$treeBuilder = new TreeBuilder('bazinga_js_translation');

$builder->root('bazinga_js_translation')
if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$rootNode = $treeBuilder->root('bazinga_js_translation');
}

$rootNode
->fixXmlConfig('active_locale')
->fixXmlConfig('active_domain')
->children()
Expand All @@ -36,6 +43,6 @@ public function getConfigTreeBuilder()
->end()
->end();

return $builder;
return $treeBuilder;
}
}
26 changes: 26 additions & 0 deletions Tests/Fixtures/app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public function getRootDir()
return __DIR__;
}

public function getProjectDir()
{
return __DIR__.'/../';
}

public function getCacheDir()
{
return sys_get_temp_dir().'/'.Kernel::VERSION.'/bazinga-js-translation/cache/'.$this->environment;
Expand All @@ -70,6 +75,10 @@ public function registerContainerConfiguration(LoaderInterface $loader)
if (self::VERSION_ID > 30200) {
$loader->load(__DIR__.'/config/disable_annotations.yml');
}

if (self::VERSION_ID < 40200 && file_exists(__DIR__.'/Resources/translations') === false) {
self::recurseCopy(__DIR__.'/../translations', __DIR__.'/Resources/translations');
}
}

public function serialize()
Expand All @@ -81,4 +90,21 @@ public function unserialize($str)
{
call_user_func_array(array($this, '__construct'), unserialize($str));
}

private static function recurseCopy($src, $dst)
{
$dir = opendir($src);
@mkdir($dst, 0777, true);
while (false !== ($file = readdir($dir))) {
if (($file !== '.') && ($file !== '..')) {
if (is_dir($src.'/'.$file)) {
self::recurseCopy($src.'/'.$file, $dst.'/'.$file);
} else {
copy($src.'/'.$file, $dst.'/'.$file);
}
}
}

closedir($dir);
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3baf98d

Please sign in to comment.