Skip to content

Commit

Permalink
Merge pull request #385 from symfony-cmf/analysis-qrYkPL
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
wouterj authored Jan 29, 2017
2 parents a45b3ac + 94571fc commit 99576cc
Show file tree
Hide file tree
Showing 45 changed files with 428 additions and 383 deletions.
8 changes: 4 additions & 4 deletions src/CmfRoutingBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
use Doctrine\ODM\PHPCR\Version as PHPCRVersion;
use Doctrine\ORM\Mapping\Driver\XmlDriver as ORMXmlDriver;
use Doctrine\ORM\Version as ORMVersion;
use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\Compiler\SetRouterPass;
use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\Compiler\ValidationPass;
use Symfony\Cmf\Component\Routing\DependencyInjection\Compiler\RegisterRouteEnhancersPass;
use Symfony\Cmf\Component\Routing\DependencyInjection\Compiler\RegisterRoutersPass;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Cmf\Component\Routing\DependencyInjection\Compiler\RegisterRoutersPass;
use Symfony\Cmf\Component\Routing\DependencyInjection\Compiler\RegisterRouteEnhancersPass;
use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\Compiler\SetRouterPass;

/**
* Bundle class.
Expand Down
6 changes: 3 additions & 3 deletions src/Controller/RedirectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\Controller;

use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Cmf\Component\Routing\RedirectRouteInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;

/**
* Default router that handles redirection route objects.
Expand Down
8 changes: 4 additions & 4 deletions src/DependencyInjection/CmfRoutingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
namespace Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection;

use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* @author Philippo de Santis
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Compiler/SetRouterPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
* Changes the Router implementation.
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Compiler/ValidationPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
* Register validation files if their storage is activated.
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection;

use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* This class contains the configuration information for the bundle.
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Orm/ContentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm;

use Symfony\Cmf\Component\Routing\ContentRepositoryInterface;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\DoctrineProvider;
use Symfony\Cmf\Component\Routing\ContentRepositoryInterface;

/**
* Abstract content repository for ORM.
Expand Down
8 changes: 4 additions & 4 deletions src/Doctrine/Orm/RouteProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\DoctrineProvider;
use Symfony\Cmf\Component\Routing\Candidates\CandidatesInterface;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Cmf\Component\Routing\RouteProviderInterface;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\DoctrineProvider;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\RouteCollection;

/**
* Provider loading routes from Doctrine.
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Phpcr/ContentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr;

use Symfony\Cmf\Component\Routing\ContentRepositoryInterface;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\DoctrineProvider;
use Symfony\Cmf\Component\Routing\ContentRepositoryInterface;

/**
* Implement ContentRepositoryInterface for PHPCR-ODM.
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Phpcr/LocaleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr;

use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
use Doctrine\ODM\PHPCR\DocumentManager;
use Doctrine\ODM\PHPCR\Event\MoveEventArgs;
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
use Symfony\Cmf\Bundle\RoutingBundle\Model\Route as ModelRoute;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Phpcr/PrefixCandidates.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr;

use PHPCR\Util\PathHelper;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\ODM\PHPCR\DocumentManager;
use Doctrine\ODM\PHPCR\Query\Builder\QueryBuilder;
use PHPCR\Util\PathHelper;
use Symfony\Cmf\Component\Routing\Candidates\Candidates;
use Symfony\Component\HttpFoundation\Request;

Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Phpcr/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use Doctrine\Common\Collections\Collection;
use Doctrine\ODM\PHPCR\Exception\InvalidArgumentException;
use Doctrine\ODM\PHPCR\HierarchyInterface;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Cmf\Bundle\RoutingBundle\Model\Route as RouteModel;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;

/**
* PHPCR-ODM routes use their path for the url. They need to have set the
Expand Down
14 changes: 7 additions & 7 deletions src/Doctrine/Phpcr/RouteProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr;

use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\ODM\PHPCR\DocumentManager;
use PHPCR\RepositoryException;
use PHPCR\Util\UUIDHelper;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\ODM\PHPCR\DocumentManager;
use Psr\Log\LoggerInterface;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\DoctrineProvider;
use Symfony\Cmf\Component\Routing\Candidates\CandidatesInterface;
use Symfony\Cmf\Component\Routing\RouteProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\Route as SymfonyRoute;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Cmf\Component\Routing\RouteProviderInterface;
use Symfony\Cmf\Component\Routing\Candidates\CandidatesInterface;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\DoctrineProvider;

/**
* Loads routes from Doctrine PHPCR-ODM.
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/RouteConditionMetadataListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Persistence\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata;
use Doctrine\ODM\PHPCR\Mapping\ClassMetadata as PhpcrClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata;
use Symfony\Component\Routing\Route;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Model/RedirectRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
namespace Symfony\Cmf\Bundle\RoutingBundle\Model;

use LogicException;
use Symfony\Component\Routing\Route as SymfonyRoute;
use Symfony\Cmf\Component\Routing\RedirectRouteInterface;
use Symfony\Component\Routing\Route as SymfonyRoute;

/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\Model;

use Symfony\Component\Routing\Route as SymfonyRoute;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\Routing\Route as SymfonyRoute;
use Symfony\Component\Routing\RouteCompiler;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Routing/DynamicRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\Routing;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Cmf\Component\Routing\DynamicRouter as BaseDynamicRouter;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;

/**
* Symfony framework integration of the CMF routing component DynamicRouter class.
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
use Doctrine\ODM\PHPCR\DocumentManager;
use PHPCR\Util\PathHelper;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route;
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase as ComponentBaseTestCase;
use Symfony\Cmf\Bundle\RoutingBundle\Tests\Resources\Document\Content;
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase as ComponentBaseTestCase;

class BaseTestCase extends ComponentBaseTestCase
{
Expand Down
10 changes: 5 additions & 5 deletions tests/Functional/Controller/RedirectControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Controller;

use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute;
use Symfony\Cmf\Bundle\RoutingBundle\Controller\RedirectController;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route;
use Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\BaseTestCase;
use Symfony\Component\HttpFoundation\RedirectResponse;

Expand Down Expand Up @@ -43,7 +43,7 @@ public function testRedirectUri()
$redirect = new RedirectRoute();
$redirect->setPosition($root, 'redirectUri');
$redirect->setUri('http://example.com/test-url');
$redirect->setParameters(array('test' => 7)); // parameters should be ignored in this case
$redirect->setParameters(['test' => 7]); // parameters should be ignored in this case
$redirect->setPermanent(true);
$this->getDm()->persist($redirect);

Expand Down Expand Up @@ -73,7 +73,7 @@ public function testRedirectContent()
$redirect = new RedirectRoute();
$redirect->setPosition($root, 'redirectContent');
$redirect->setRouteTarget($route);
$redirect->setParameters(array('test' => 'content'));
$redirect->setParameters(['test' => 'content']);
$this->getDm()->persist($redirect);

$this->getDm()->flush();
Expand All @@ -95,7 +95,7 @@ public function testRedirectName()
$redirect = new RedirectRoute();
$redirect->setPosition($root, 'redirectName');
$redirect->setRouteName('symfony_route');
$redirect->setParameters(array('param' => 7)); // parameters should be ignored in this case
$redirect->setParameters(['param' => 7]); // parameters should be ignored in this case
$this->getDm()->persist($redirect);

$this->getDm()->flush();
Expand Down
6 changes: 3 additions & 3 deletions tests/Functional/Doctrine/Orm/OrmTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Doctrine\Orm;

use Symfony\Cmf\Component\Testing\Functional\BaseTestCase as ComponentBaseTestCase;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route;
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase as ComponentBaseTestCase;

class OrmTestCase extends ComponentBaseTestCase
{
protected function getKernelConfiguration()
{
return array(
return [
'environment' => 'orm',
);
];
}

protected function clearDb($model)
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Doctrine/Phpcr/RedirectRouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Doctrine\Phpcr;

use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route;
use Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\BaseTestCase;
use Symfony\Cmf\Component\Routing\RedirectRouteInterface;
use Symfony\Cmf\Component\Routing\RouteReferrersReadInterface;
Expand Down Expand Up @@ -56,7 +56,7 @@ public function testRedirectDoctrine()
$params = $redirect->getParameters();
$this->assertSame($route, $redirect->getRouteTarget());
$defaults = $redirect->getDefaults();
$this->assertEquals(array('test' => 'toast'), $defaults);
$this->assertEquals(['test' => 'toast'], $defaults);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/Functional/Doctrine/Phpcr/RouteProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Doctrine\Phpcr;

use Doctrine\ODM\PHPCR\Document\Generic;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RouteProvider;
use Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\BaseTestCase;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouteCollection;

class RouteProviderTest extends BaseTestCase
Expand Down Expand Up @@ -125,12 +125,12 @@ public function testGetRoutesByNames()
{
$this->buildRoutes();

$routeNames = array(
$routeNames = [
self::ROUTE_ROOT.'/testroute/noroute/child',
self::ROUTE_ROOT.'/testroute/noroute',
self::ROUTE_ROOT.'/testroute/', // trailing slash is invalid for phpcr
self::ROUTE_ROOT.'/testroute',
);
];

$routes = $this->repository->getRoutesByNames($routeNames);
$this->assertCount(2, $routes);
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Doctrine/Phpcr/RouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testPersist()
$route->setPosition($root, 'testroute');
$route->setDefault('x', 'y');
$route->setRequirement('testreq', 'testregex');
$route->setOptions(array('test' => 'value'));
$route->setOptions(['test' => 'value']);
$route->setOption('another', 'value2');

$this->getDm()->persist($route);
Expand Down Expand Up @@ -159,7 +159,7 @@ public function testPrefixNonpersisted()

public function testDefaultFormat()
{
$route = new Route(array('add_format_pattern' => true));
$route = new Route(['add_format_pattern' => true]);

$root = $this->getDm()->find(null, self::ROUTE_ROOT);

Expand Down
Loading

0 comments on commit 99576cc

Please sign in to comment.