From d6cd4ddce4cd6acadb2ea1f58c7d3861f529c497 Mon Sep 17 00:00:00 2001 From: Piotr Szymaszek Date: Fri, 1 Sep 2017 15:15:47 +0200 Subject: [PATCH 1/6] Removed datasource and datagrid components from requirements, moved them to dev --- composer.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index bd91b996..6ab7d72a 100644 --- a/composer.json +++ b/composer.json @@ -31,8 +31,7 @@ "symfony/templating": "^2.4|^3.0", "sensio/framework-extra-bundle": "^3.0", "symfony/twig-bundle": "^2.3|^3.0", - "fsi/datagrid-bundle" : "^1.2|^2.0@dev", - "fsi/datasource": "^1.3@dev", + "fsi/datagrid-bundle" : "^2.0@dev", "fsi/datasource-bundle": "^2.0@dev", "knplabs/knp-menu-bundle": "^2.0", "doctrine/annotations": "^1.0", @@ -43,6 +42,8 @@ "symfony/monolog-bundle": "^2.3|^3.0", "ext-pdo_sqlite": "*", "fsi/resource-repository-bundle": "^1.1.5|^2.0@dev", + "fsi/datagrid": "^1.3|^2.0@dev", + "fsi/datasource": "^1.3|^2.0@dev", "fsi/doctrine-extensions": "^1.1.4|^2.0@dev", "fsi/doctrine-extensions-bundle": "^1.1.4|^2.0@dev", "doctrine/doctrine-bundle": "^1.4", From d55e81f6fea3c1a04b0938ef2df49270f043a245 Mon Sep 17 00:00:00 2001 From: Piotr Szymaszek Date: Tue, 5 Sep 2017 11:28:04 +0200 Subject: [PATCH 2/6] Added specific Firefox and selenium version in Travis builds --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index df0d0e9e..e2991692 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,9 @@ cache: - bin - vendor +addons: + firefox: "47.0.1" + matrix: include: - php: 5.4 @@ -28,12 +31,12 @@ matrix: - php: 7.1 before_install: - - phpenv config-rm xdebug.ini || true + - phpenv config-rm xdebug.ini - if [[ $SYMFONY_VERSION ]]; then composer require symfony/symfony:${SYMFONY_VERSION} -n --no-update; fi; # Avoid issues on composer update - echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - composer update $COMPOSER_FLAGS - - "[ ! -f bin/selenium.jar ] && wget wget -O bin/selenium.jar http://selenium-release.storage.googleapis.com/2.50/selenium-server-standalone-2.50.1.jar || true" + - wget --no-clobber -O bin/selenium.jar http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar || true before_script: - nohup php -S localhost:8080 -t features/fixtures/project/web > /dev/null 2>&1 & From 918419c2bb53fc86fd1d7bfbf76b26cdb6aca243 Mon Sep 17 00:00:00 2001 From: Piotr Szymaszek Date: Tue, 5 Sep 2017 15:39:57 +0200 Subject: [PATCH 3/6] Allow 1.2 version of datagrid-bundle --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6ab7d72a..314cf42a 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "symfony/templating": "^2.4|^3.0", "sensio/framework-extra-bundle": "^3.0", "symfony/twig-bundle": "^2.3|^3.0", - "fsi/datagrid-bundle" : "^2.0@dev", + "fsi/datagrid-bundle" : "^1.2|^2.0@dev", "fsi/datasource-bundle": "^2.0@dev", "knplabs/knp-menu-bundle": "^2.0", "doctrine/annotations": "^1.0", From 011f311f613ceaf0a9a29b2a959af7dba85050b6 Mon Sep 17 00:00:00 2001 From: Piotr Szymaszek Date: Mon, 11 Sep 2017 13:18:54 +0200 Subject: [PATCH 4/6] Remove iirc push from Travis --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e2991692..335db9bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,4 @@ before_script: script: - bin/phpspec run --format=pretty - - bin/behat --no-snippets --format=progress --profile=travis - -notifications: - irc: "irc.freenode.org#fsi-open" + - bin/behat --no-snippets --profile=travis -vvv From c57f43f5d4b722fb0b465d46bedc41e786b47a12 Mon Sep 17 00:00:00 2001 From: Piotr Szymaszek Date: Tue, 12 Sep 2017 12:50:42 +0200 Subject: [PATCH 5/6] Dropped support for PHP below 7.1 --- .travis.yml | 16 ++-------------- composer.json | 2 +- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 335db9bb..d4a514ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,21 +13,9 @@ addons: matrix: include: - - php: 5.4 + - php: 7.1 env: - COMPOSER_FLAGS='--prefer-lowest' - - php: 5.5 - - php: 5.6 - env: - - SYMFONY_VERSION=2.6.* - - php: 5.6 - env: - - SYMFONY_VERSION=2.7.* - - php: 5.6 - env: - - SYMFONY_VERSION=2.8.* - - php: 5.6 - - php: 7.0 - php: 7.1 before_install: @@ -48,4 +36,4 @@ before_script: script: - bin/phpspec run --format=pretty - - bin/behat --no-snippets --profile=travis -vvv + - bin/behat --no-snippets --format=progress --profile=travis diff --git a/composer.json b/composer.json index 314cf42a..587bfa2d 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": ">=5.4.0", + "php": ">=7.1", "symfony/framework-bundle" : "^2.4|^3.0", "symfony/form" : "^2.3|^3.0", "symfony/intl" : "^2.6|^3.0", From 0dcdd79577a037e37b53cbe19791aa9a3732eeb7 Mon Sep 17 00:00:00 2001 From: Piotr Szymaszek Date: Tue, 12 Sep 2017 14:49:56 +0200 Subject: [PATCH 6/6] Fixed deprecated template calls, CS fixes --- CHANGELOG-3.0.md | 5 +++++ .../Compiler/AdminAnnotatedElementPass.php | 19 ++++++------------- .../Compiler/AdminElementPass.php | 6 ++++-- DependencyInjection/Compiler/ContextPass.php | 6 ------ .../Compiler/KnpMenuBuilderPass.php | 5 +---- .../Compiler/ManagerVisitorPass.php | 5 +---- .../Compiler/ResourceRepositoryPass.php | 5 ++++- .../Compiler/TwigGlobalsPass.php | 11 ++++------- Resources/views/Admin/index.html.twig | 3 +-- .../views/Admin/main_menu_theme.html.twig | 5 +++-- .../views/Admin/tools_menu_theme.html.twig | 2 +- UPGRADE-3.0.md | 4 ++++ features/fixtures/project/web/app_test.php | 1 - 13 files changed, 34 insertions(+), 43 deletions(-) diff --git a/CHANGELOG-3.0.md b/CHANGELOG-3.0.md index 49180d91..247f1fd1 100644 --- a/CHANGELOG-3.0.md +++ b/CHANGELOG-3.0.md @@ -176,3 +176,8 @@ it has became redundant and will be removed. ## Dropped routes deprecated back in 1.1 Refer to [1.1 changelog](CHANGELOG-1.1.md) for information on which routes have been removed. + +## Dropped support for PHP below 7.1 + +To be able to fully utilize new functionality introduced in 7.1, we have decided +to only support PHP versions equal or higher to it. diff --git a/DependencyInjection/Compiler/AdminAnnotatedElementPass.php b/DependencyInjection/Compiler/AdminAnnotatedElementPass.php index 13f00349..f8536c03 100644 --- a/DependencyInjection/Compiler/AdminAnnotatedElementPass.php +++ b/DependencyInjection/Compiler/AdminAnnotatedElementPass.php @@ -11,11 +11,11 @@ use Doctrine\Common\Annotations\AnnotationReader; use FSi\Bundle\AdminBundle\Annotation\Element; -use FSi\Bundle\AdminBundle\Extractor\BundlePathExtractor; use FSi\Bundle\AdminBundle\Finder\AdminClassFinder; +use ReflectionClass; use Symfony\Component\Config\Resource\DirectoryResource; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; class AdminAnnotatedElementPass implements CompilerPassInterface @@ -32,19 +32,12 @@ class AdminAnnotatedElementPass implements CompilerPassInterface */ private $adminClassFinder; - /** - * @param AnnotationReader $annotationReader - * @param AdminClassFinder $adminClassFinder - */ public function __construct(AnnotationReader $annotationReader, AdminClassFinder $adminClassFinder) { $this->annotationReader = $annotationReader; $this->adminClassFinder = $adminClassFinder; } - /** - * @param ContainerBuilder $container - */ public function process(ContainerBuilder $container) { $paths = $this->getBundlesAdminPaths($container); @@ -58,7 +51,7 @@ public function process(ContainerBuilder $container) } /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + * @param ContainerBuilder $container * @return array */ private function getBundlesAdminPaths(ContainerBuilder $container) @@ -66,7 +59,7 @@ private function getBundlesAdminPaths(ContainerBuilder $container) $bundleClasses = $container->getParameter('kernel.bundles'); $paths = []; foreach ($bundleClasses as $bundleClass) { - $bundleClassReflector = new \ReflectionClass($bundleClass); + $bundleClassReflector = new ReflectionClass($bundleClass); $bundleAdminPath = dirname($bundleClassReflector->getFileName()) . '/Admin'; if (is_dir($bundleAdminPath)) { $container->addResource(new DirectoryResource($bundleAdminPath, '/\.php$/')); @@ -78,7 +71,7 @@ private function getBundlesAdminPaths(ContainerBuilder $container) /** * @param $class - * @return \Symfony\Component\DependencyInjection\Definition + * @return Definition */ private function createAdminElementDefinition($class) { @@ -98,7 +91,7 @@ private function findAnnotatedAdminClasses(array $paths) foreach ($this->adminClassFinder->findClasses($paths) as $class) { $annotation = $this->annotationReader->getClassAnnotation( - new \ReflectionClass($class), + new ReflectionClass($class), self::ANNOTATION_CLASS ); diff --git a/DependencyInjection/Compiler/AdminElementPass.php b/DependencyInjection/Compiler/AdminElementPass.php index e7afc828..fbbbdff2 100644 --- a/DependencyInjection/Compiler/AdminElementPass.php +++ b/DependencyInjection/Compiler/AdminElementPass.php @@ -23,13 +23,15 @@ class AdminElementPass implements CompilerPassInterface */ public function process(ContainerBuilder $container) { - if (!$container->hasDefinition('admin.manager') || !$container->has('admin.manager.visitor.element_collection')) { + if (!$container->hasDefinition('admin.manager') + || !$container->has('admin.manager.visitor.element_collection') + ) { return; } $elements = []; $elementServices = $container->findTaggedServiceIds('admin.element'); - foreach ($elementServices as $id => $tag) { + foreach (array_keys($elementServices) as $id) { $elements[] = new Reference($id); } diff --git a/DependencyInjection/Compiler/ContextPass.php b/DependencyInjection/Compiler/ContextPass.php index 6a99cb5c..7bf0b0db 100644 --- a/DependencyInjection/Compiler/ContextPass.php +++ b/DependencyInjection/Compiler/ContextPass.php @@ -12,14 +12,8 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -/** - * @author Norbert Orzechowicz - */ class ContextPass implements CompilerPassInterface { - /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container - */ public function process(ContainerBuilder $container) { if (!$container->hasDefinition('admin.context.manager')) { diff --git a/DependencyInjection/Compiler/KnpMenuBuilderPass.php b/DependencyInjection/Compiler/KnpMenuBuilderPass.php index 9c4a5ce4..58d16421 100644 --- a/DependencyInjection/Compiler/KnpMenuBuilderPass.php +++ b/DependencyInjection/Compiler/KnpMenuBuilderPass.php @@ -14,9 +14,6 @@ class KnpMenuBuilderPass implements CompilerPassInterface { - /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container - */ public function process(ContainerBuilder $container) { if (!$container->hasDefinition('admin.menu.knp.decorator.chain')) { @@ -26,7 +23,7 @@ public function process(ContainerBuilder $container) $decoratorServices = $container->findTaggedServiceIds('admin.menu.knp_decorator'); $decorators = []; - foreach ($decoratorServices as $id => $tag) { + foreach (array_keys($decoratorServices) as $id) { $decorators[] = $container->findDefinition($id); } diff --git a/DependencyInjection/Compiler/ManagerVisitorPass.php b/DependencyInjection/Compiler/ManagerVisitorPass.php index 142d6a91..786bcd4a 100644 --- a/DependencyInjection/Compiler/ManagerVisitorPass.php +++ b/DependencyInjection/Compiler/ManagerVisitorPass.php @@ -14,9 +14,6 @@ class ManagerVisitorPass implements CompilerPassInterface { - /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container - */ public function process(ContainerBuilder $container) { if (!$container->hasDefinition('admin.manager')) { @@ -24,7 +21,7 @@ public function process(ContainerBuilder $container) } $elementServices = $container->findTaggedServiceIds('admin.manager.visitor'); - foreach ($elementServices as $id => $tag) { + foreach (array_keys($elementServices) as $id) { $visitor = $container->findDefinition($id); $container->findDefinition('admin.manager')->addMethodCall('accept', [$visitor]); diff --git a/DependencyInjection/Compiler/ResourceRepositoryPass.php b/DependencyInjection/Compiler/ResourceRepositoryPass.php index e693eec5..60facc96 100644 --- a/DependencyInjection/Compiler/ResourceRepositoryPass.php +++ b/DependencyInjection/Compiler/ResourceRepositoryPass.php @@ -15,7 +15,10 @@ class ResourceRepositoryPass implements CompilerPassInterface public function process(ContainerBuilder $container) { if ($container->hasExtension('fsi_resource_repository')) { - $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../../Resources/config')); + $loader = new XmlFileLoader( + $container, + new FileLocator(__DIR__.'/../../Resources/config') + ); $loader->load('context/resource.xml'); } } diff --git a/DependencyInjection/Compiler/TwigGlobalsPass.php b/DependencyInjection/Compiler/TwigGlobalsPass.php index 294e0792..92f7f11d 100644 --- a/DependencyInjection/Compiler/TwigGlobalsPass.php +++ b/DependencyInjection/Compiler/TwigGlobalsPass.php @@ -14,9 +14,6 @@ class TwigGlobalsPass implements CompilerPassInterface { - /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container - */ public function process(ContainerBuilder $container) { if (!$container->hasDefinition('twig')) { @@ -24,10 +21,10 @@ public function process(ContainerBuilder $container) } $parameters = [ - 'admin_templates_base' => $container->getParameter('admin.templates.base'), - 'admin_templates_form_theme' => $container->getParameter('admin.templates.form_theme'), - 'admin_templates_datagrid_theme' => $container->getParameter('admin.templates.datagrid_theme'), - 'admin_templates_datasource_theme' => $container->getParameter('admin.templates.datasource_theme'), + 'admin_templates_base' => $container->getParameter('admin.templates.base'), + 'admin_templates_form_theme' => $container->getParameter('admin.templates.form_theme'), + 'admin_templates_datagrid_theme' => $container->getParameter('admin.templates.datagrid_theme'), + 'admin_templates_datasource_theme' => $container->getParameter('admin.templates.datasource_theme'), ]; $twig = $container->findDefinition('twig'); diff --git a/Resources/views/Admin/index.html.twig b/Resources/views/Admin/index.html.twig index 82f14d44..f8e4c00a 100644 --- a/Resources/views/Admin/index.html.twig +++ b/Resources/views/Admin/index.html.twig @@ -1,6 +1,5 @@ {% extends admin_templates_base %} {% block content %} -
-
+
{% endblock %} diff --git a/Resources/views/Admin/main_menu_theme.html.twig b/Resources/views/Admin/main_menu_theme.html.twig index 99d952cb..58dbc436 100644 --- a/Resources/views/Admin/main_menu_theme.html.twig +++ b/Resources/views/Admin/main_menu_theme.html.twig @@ -1,9 +1,10 @@ {% extends 'knp_menu.html.twig' %} -{% block label %}{{ item.label|trans|humanize }}{% endblock %} +{% import "knp_menu.html.twig" as macros %} + +{% block label item.label|trans|humanize %} {% block item %} -{% import "knp_menu.html.twig" as macros %} {% if item.displayed %} {# building the class of the item #} {%- set classes = item.attribute('class') is not empty ? [item.attribute('class')] : [] %} diff --git a/Resources/views/Admin/tools_menu_theme.html.twig b/Resources/views/Admin/tools_menu_theme.html.twig index cc5a67da..884d6200 100644 --- a/Resources/views/Admin/tools_menu_theme.html.twig +++ b/Resources/views/Admin/tools_menu_theme.html.twig @@ -5,4 +5,4 @@ {{ block('list') -}} {% endblock %} -{% block label %}{{ item.label|trans({}, 'FSiAdminBundle') }}{% endblock %} +{% block label item.label|trans({}, 'FSiAdminBundle') %} diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index e70b0146..b82fd5a4 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -65,3 +65,7 @@ may receive an exception when handling batch actions. ## Do not use routes deprecated back in version 1.1 Refer to [1.1 changelog](CHANGELOG-1.1.md) for information on which routes have been removed. + +## Upgrade to PHP 7.1 or higher + +In order to use this bundle, you will need PHP 7.1 or higher. diff --git a/features/fixtures/project/web/app_test.php b/features/fixtures/project/web/app_test.php index e2c44673..76c99d78 100644 --- a/features/fixtures/project/web/app_test.php +++ b/features/fixtures/project/web/app_test.php @@ -9,7 +9,6 @@ require_once __DIR__.'/../app/AppKernel.php'; $kernel = new AppKernel('test', true); -$kernel->loadClassCache(); Request::enableHttpMethodParameterOverride(); $request = Request::createFromGlobals(); $response = $kernel->handle($request);