From 17424f6d499834d69afc69851e5ec50e227d430b Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 14 Dec 2016 17:48:00 +0100 Subject: [PATCH 1/4] Change the way to inject ActiveTheme since Symfony 3.2.1 In Symfonny 3.2.1 a new parameter has been added to the TwigBundle FilesystemLoader breaking the LiipThemeBundle own FilesystemLoader. Instead of adding a 4th parameter, we define the service to call a method after being instanciated to define the ActiveTheme. --- .../Compiler/ThemeCompilerPass.php | 2 +- Twig/Loader/FilesystemLoader.php | 22 ++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/DependencyInjection/Compiler/ThemeCompilerPass.php b/DependencyInjection/Compiler/ThemeCompilerPass.php index 3d54767..f35685b 100644 --- a/DependencyInjection/Compiler/ThemeCompilerPass.php +++ b/DependencyInjection/Compiler/ThemeCompilerPass.php @@ -30,6 +30,6 @@ public function process(ContainerBuilder $container) $twigFilesystemLoaderDefinition = $container->getDefinition('twig.loader.filesystem'); $twigFilesystemLoaderDefinition->setClass($container->getParameter('liip_theme.filesystem_loader.class')); - $twigFilesystemLoaderDefinition->addArgument(new Reference('liip_theme.active_theme')); + $twigFilesystemLoaderDefinition->addMethodCall('setActiveTheme', [new Reference('liip_theme.active_theme')]); } } diff --git a/Twig/Loader/FilesystemLoader.php b/Twig/Loader/FilesystemLoader.php index 969c050..5fe44e4 100644 --- a/Twig/Loader/FilesystemLoader.php +++ b/Twig/Loader/FilesystemLoader.php @@ -19,15 +19,27 @@ class FilesystemLoader extends \Twig_Loader_Filesystem /** * Constructor. * - * @param FileLocatorInterface $locator A FileLocatorInterface instance - * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance - * @param ActiveTheme $activeTheme + * @see TwigBundle own FilesystemLoader + * + * @param FileLocatorInterface $locator A FileLocatorInterface instance + * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance + * @param string|null $rootPath The root path common to all relative paths (null for getcwd()) */ - public function __construct(FileLocatorInterface $locator, TemplateNameParserInterface $parser, ActiveTheme $activeTheme = null) + public function __construct(FileLocatorInterface $locator, TemplateNameParserInterface $parser, $rootPath = null) { - parent::__construct(array()); + parent::__construct(array(), $rootPath); + $this->locator = $locator; $this->parser = $parser; + } + + /** + * Define the active theme + * + * @param ActiveTheme $activeTheme + */ + public function setActiveTheme(ActiveTheme $activeTheme = null) + { $this->activeTheme = $activeTheme; } From 97ceb5975a319f6f45ed3164c18d3f3f99ad605f Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 14 Dec 2016 17:56:21 +0100 Subject: [PATCH 2/4] Add more Symfony version in Travis --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 9de540e..d98c3b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,10 @@ matrix: env: SYMFONY_VERSION=2.8.* - php: 5.6 env: SYMFONY_VERSION=3.0.* + - php: 5.6 + env: SYMFONY_VERSION=3.1.* + - php: 5.6 + env: SYMFONY_VERSION=3.2.* - php: 5.6 env: TWIG_VERSION=2.x - php: 5.3 From 7ff4875327f37b275363de5440ef392ba1bffc4e Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 14 Dec 2016 17:57:40 +0100 Subject: [PATCH 3/4] Fix brackets for PHP 5.3 --- DependencyInjection/Compiler/ThemeCompilerPass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DependencyInjection/Compiler/ThemeCompilerPass.php b/DependencyInjection/Compiler/ThemeCompilerPass.php index f35685b..a025656 100644 --- a/DependencyInjection/Compiler/ThemeCompilerPass.php +++ b/DependencyInjection/Compiler/ThemeCompilerPass.php @@ -30,6 +30,6 @@ public function process(ContainerBuilder $container) $twigFilesystemLoaderDefinition = $container->getDefinition('twig.loader.filesystem'); $twigFilesystemLoaderDefinition->setClass($container->getParameter('liip_theme.filesystem_loader.class')); - $twigFilesystemLoaderDefinition->addMethodCall('setActiveTheme', [new Reference('liip_theme.active_theme')]); + $twigFilesystemLoaderDefinition->addMethodCall('setActiveTheme', array(new Reference('liip_theme.active_theme'))); } } From 5cd214b5bee1b54ac4ebabab2270239a7ac17c07 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 15 Dec 2016 08:58:54 +0100 Subject: [PATCH 4/4] Add Symfony@dev as allowed to fail --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index d98c3b5..d705086 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ env: - SYMFONY_VERSION=2.7.* matrix: + fast_finish: true include: - php: 5.6 env: SYMFONY_VERSION=2.3.* @@ -29,10 +30,15 @@ matrix: env: SYMFONY_VERSION=3.1.* - php: 5.6 env: SYMFONY_VERSION=3.2.* + - php: 5.6 + env: SYMFONY_VERSION=@dev - php: 5.6 env: TWIG_VERSION=2.x - php: 5.3 env: COMPOSER_FLAGS="--prefer-lowest" + allow_failures: + - php: 5.6 + env: SYMFONY_VERSION=@dev before_install: - if [[ ${TRAVIS_PHP_VERSION} != "hhvm" ]]; then phpenv config-add travis.php.ini; fi;