Skip to content

Commit

Permalink
Merge pull request fsi-open#310 from szymach/deps
Browse files Browse the repository at this point in the history
 Removed datasource and datagrid components from requirements, requiring PHP >= 7.1
  • Loading branch information
rn0 authored Sep 13, 2017
2 parents 0095da2 + 0dcdd79 commit b76f0ec
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 63 deletions.
24 changes: 6 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,23 @@ cache:
- bin
- vendor

addons:
firefox: "47.0.1"

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:
- 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 &
Expand All @@ -46,6 +37,3 @@ before_script:
script:
- bin/phpspec run --format=pretty
- bin/behat --no-snippets --format=progress --profile=travis

notifications:
irc: "irc.freenode.org#fsi-open"
5 changes: 5 additions & 0 deletions CHANGELOG-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
19 changes: 6 additions & 13 deletions DependencyInjection/Compiler/AdminAnnotatedElementPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -58,15 +51,15 @@ public function process(ContainerBuilder $container)
}

/**
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
* @param ContainerBuilder $container
* @return array
*/
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$/'));
Expand All @@ -78,7 +71,7 @@ private function getBundlesAdminPaths(ContainerBuilder $container)

/**
* @param $class
* @return \Symfony\Component\DependencyInjection\Definition
* @return Definition
*/
private function createAdminElementDefinition($class)
{
Expand All @@ -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
);

Expand Down
6 changes: 4 additions & 2 deletions DependencyInjection/Compiler/AdminElementPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 0 additions & 6 deletions DependencyInjection/Compiler/ContextPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,8 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

/**
* @author Norbert Orzechowicz <[email protected]>
*/
class ContextPass implements CompilerPassInterface
{
/**
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('admin.context.manager')) {
Expand Down
5 changes: 1 addition & 4 deletions DependencyInjection/Compiler/KnpMenuBuilderPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand All @@ -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);
}

Expand Down
5 changes: 1 addition & 4 deletions DependencyInjection/Compiler/ManagerVisitorPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@

class ManagerVisitorPass implements CompilerPassInterface
{
/**
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('admin.manager')) {
return;
}

$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]);
Expand Down
5 changes: 4 additions & 1 deletion DependencyInjection/Compiler/ResourceRepositoryPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
Expand Down
11 changes: 4 additions & 7 deletions DependencyInjection/Compiler/TwigGlobalsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@

class TwigGlobalsPass implements CompilerPassInterface
{
/**
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('twig')) {
return;
}

$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');
Expand Down
3 changes: 1 addition & 2 deletions Resources/views/Admin/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% extends admin_templates_base %}

{% block content %}
<div class="col-lg-10">
</div>
<div class="col-lg-10"></div>
{% endblock %}
5 changes: 3 additions & 2 deletions Resources/views/Admin/main_menu_theme.html.twig
Original file line number Diff line number Diff line change
@@ -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')] : [] %}
Expand Down
2 changes: 1 addition & 1 deletion Resources/views/Admin/tools_menu_theme.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
{{ block('list') -}}
{% endblock %}

{% block label %}{{ item.label|trans({}, 'FSiAdminBundle') }}{% endblock %}
{% block label item.label|trans({}, 'FSiAdminBundle') %}
4 changes: 4 additions & 0 deletions UPGRADE-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -32,7 +32,6 @@
"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/datasource-bundle": "^2.0@dev",
"knplabs/knp-menu-bundle": "^2.0",
"doctrine/annotations": "^1.0",
Expand All @@ -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",
Expand Down
1 change: 0 additions & 1 deletion features/fixtures/project/web/app_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b76f0ec

Please sign in to comment.