Skip to content

Commit f3c7bab

Browse files
Merge pull request #186 from symfony-cmf/php56
minimum php version is 5.6 now
2 parents 0aa8838 + 07343f3 commit f3c7bab

32 files changed

+430
-415
lines changed

.travis.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
language: php
22

33
php:
4-
- 5.5
5-
- 5.6
64
- 7.0
7-
- 7.1
85
- hhvm
96

107
sudo: false
@@ -13,17 +10,21 @@ cache:
1310
directories:
1411
- $HOME/.composer/cache/files
1512

16-
env: SYMFONY_VERSION=3.2.*
13+
env:
14+
matrix:
15+
- SYMFONY_VERSION=3.2.*
16+
global:
17+
- SYMFONY_PHPUNIT_DIR=.phpunit
18+
- SYMFONY_PHPUNIT_REMOVE="symfony/yaml"
19+
- SYMFONY_PHPUNIT_VERSION=5.6
1720

1821
matrix:
1922
include:
2023
- php: 7.1
2124
env: SYMFONY_VERSION=3.3.* DEPS=dev
22-
- php: 5.5
23-
env: SYMFONY_VERSION=2.8.* COMPOSER_FLAGS="--prefer-lowest"
24-
- php: 5.6
25-
env: SYMFONY_VERSION=2.7.*
2625
- php: 5.6
26+
env: SYMFONY_VERSION=2.8.* COMPOSER_FLAGS="--prefer-lowest"
27+
- php: 7.1
2728
env: SYMFONY_VERSION=3.1.*
2829
finish_fast: true
2930

@@ -36,7 +37,7 @@ before_install:
3637

3738
install: composer update --prefer-dist $COMPOSER_FLAGS
3839

39-
script: phpunit
40+
script: vendor/bin/simple-phpunit
4041

4142
notifications:
4243
irc: "irc.freenode.org#symfony-cmf"

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
}
1313
],
1414
"require": {
15-
"php": "^5.5.9|^7.0",
15+
"php": "^5.6.0|^7.0",
1616
"symfony/routing": "^2.2|^3.0",
1717
"symfony/http-kernel": "^2.2|^3.0",
1818
"psr/log": "^1.0"
1919
},
2020
"require-dev": {
2121
"symfony-cmf/testing": "^1.3|^2.0",
22+
"symfony/phpunit-bridge": "^3.2",
2223
"symfony/dependency-injection": "^2.0.5|^3.0",
2324
"symfony/config": "^2.2|^3.0",
2425
"symfony/event-dispatcher": "^2.1|^3.0",

src/Candidates/Candidates.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Candidates implements CandidatesInterface
4343
* @param array $locales The locales to support
4444
* @param int $limit A limit to apply to the candidates generated
4545
*/
46-
public function __construct(array $locales = array(), $limit = 20)
46+
public function __construct(array $locales = [], $limit = 20)
4747
{
4848
$this->setLocales($locales);
4949
$this->limit = $limit;
@@ -107,7 +107,7 @@ protected function determineLocale($url)
107107
return false;
108108
}
109109

110-
$matches = array();
110+
$matches = [];
111111
if (preg_match('#('.implode('|', $this->locales).')(/|$)#', $url, $matches)) {
112112
return $matches[1];
113113
}
@@ -128,7 +128,7 @@ protected function determineLocale($url)
128128
*/
129129
protected function getCandidatesFor($url, $prefix = '')
130130
{
131-
$candidates = array();
131+
$candidates = [];
132132
if ('/' !== $url) {
133133
// handle format extension, like .html or .json
134134
if (preg_match('/(.+)\.[a-z]+$/i', $url, $matches)) {

src/ChainRouteCollection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ChainRouteCollection extends RouteCollection
2020
/**
2121
* @var RouteCollection[]
2222
*/
23-
private $routeCollections = array();
23+
private $routeCollections = [];
2424

2525
/**
2626
* @var RouteCollection
@@ -140,7 +140,7 @@ public function addCollection(RouteCollection $collection)
140140
* @param array $defaults An array of default values
141141
* @param array $requirements An array of requirements
142142
*/
143-
public function addPrefix($prefix, array $defaults = array(), array $requirements = array())
143+
public function addPrefix($prefix, array $defaults = [], array $requirements = [])
144144
{
145145
$this->createInternalCollection();
146146
foreach ($this->routeCollections as $routeCollection) {
@@ -155,7 +155,7 @@ public function addPrefix($prefix, array $defaults = array(), array $requirement
155155
* @param array $defaults An array of default values
156156
* @param array $requirements An array of requirements
157157
*/
158-
public function setHost($pattern, array $defaults = array(), array $requirements = array())
158+
public function setHost($pattern, array $defaults = [], array $requirements = [])
159159
{
160160
$this->createInternalCollection();
161161
foreach ($this->routeCollections as $routeCollection) {

src/ChainRouter.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ChainRouter implements ChainRouterInterface, WarmableInterface
4242
*
4343
* @var array
4444
*/
45-
private $routers = array();
45+
private $routers = [];
4646

4747
/**
4848
* @var RouterInterface[] Array of routers, sorted by priority
@@ -86,11 +86,11 @@ public function add($router, $priority = 0)
8686
throw new \InvalidArgumentException(sprintf('%s is not a valid router.', get_class($router)));
8787
}
8888
if (empty($this->routers[$priority])) {
89-
$this->routers[$priority] = array();
89+
$this->routers[$priority] = [];
9090
}
9191

9292
$this->routers[$priority][] = $router;
93-
$this->sortedRouters = array();
93+
$this->sortedRouters = [];
9494
}
9595

9696
/**
@@ -127,7 +127,7 @@ protected function sortRouters()
127127
krsort($this->routers);
128128

129129
if (0 === count($this->routers)) {
130-
return array();
130+
return [];
131131
}
132132

133133
return call_user_func_array('array_merge', $this->routers);
@@ -212,9 +212,9 @@ private function doMatch($pathinfo, Request $request = null)
212212
* Loops through all registered routers and returns a router if one is found.
213213
* It will always return the first route generated.
214214
*/
215-
public function generate($name, $parameters = array(), $absolute = UrlGeneratorInterface::ABSOLUTE_PATH)
215+
public function generate($name, $parameters = [], $absolute = UrlGeneratorInterface::ABSOLUTE_PATH)
216216
{
217-
$debug = array();
217+
$debug = [];
218218

219219
foreach ($this->all() as $router) {
220220
// if $router does not announce it is capable of handling
@@ -266,7 +266,7 @@ private function rebuildRequest($pathinfo)
266266

267267
$uri = $pathinfo;
268268

269-
$server = array();
269+
$server = [];
270270
if ($this->context->getBaseUrl()) {
271271
$uri = $this->context->getBaseUrl().$pathinfo;
272272
$server['SCRIPT_FILENAME'] = $this->context->getBaseUrl();
@@ -281,7 +281,7 @@ private function rebuildRequest($pathinfo)
281281
}
282282
$uri = $this->context->getScheme().'://'.$host.$uri.'?'.$this->context->getQueryString();
283283

284-
return Request::create($uri, $this->context->getMethod(), $this->context->getParameters(), array(), array(), $server);
284+
return Request::create($uri, $this->context->getMethod(), $this->context->getParameters(), [], [], $server);
285285
}
286286

287287
private function getErrorMessage($name, $router = null, $parameters = null)

src/ContentAwareGenerator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function setContentRepository(ContentRepositoryInterface $contentReposito
6666
*
6767
* @throws RouteNotFoundException If there is no such route in the database
6868
*/
69-
public function generate($name, $parameters = array(), $absolute = UrlGeneratorInterface::ABSOLUTE_PATH)
69+
public function generate($name, $parameters = [], $absolute = UrlGeneratorInterface::ABSOLUTE_PATH)
7070
{
7171
if ($name instanceof SymfonyRoute) {
7272
$route = $this->getBestLocaleRoute($name, $parameters);
@@ -122,6 +122,7 @@ protected function getBestLocaleRoute(SymfonyRoute $route, $parameters)
122122
return $route;
123123
}
124124
$locale = $this->getLocale($parameters);
125+
125126
if (!$this->checkLocaleRequirement($route, $locale)) {
126127
$content = $route->getContent();
127128
if ($content instanceof RouteReferrersReadInterface) {
@@ -284,7 +285,7 @@ public function supports($name)
284285
/**
285286
* {@inheritdoc}
286287
*/
287-
public function getRouteDebugMessage($name, array $parameters = array())
288+
public function getRouteDebugMessage($name, array $parameters = [])
288289
{
289290
if (!$name && array_key_exists('content_id', $parameters)) {
290291
return 'Content id '.$parameters['content_id'];

src/DependencyInjection/Compiler/RegisterRouteEnhancersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function process(ContainerBuilder $container)
5353

5454
foreach ($container->findTaggedServiceIds($this->enhancerTag) as $id => $attributes) {
5555
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
56-
$router->addMethodCall('addRouteEnhancer', array(new Reference($id), $priority));
56+
$router->addMethodCall('addRouteEnhancer', [new Reference($id), $priority]);
5757
}
5858
}
5959
}

src/DependencyInjection/Compiler/RegisterRoutersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function process(ContainerBuilder $container)
4848
foreach ($container->findTaggedServiceIds($this->routerTag) as $id => $attributes) {
4949
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
5050

51-
$definition->addMethodCall('add', array(new Reference($id), $priority));
51+
$definition->addMethodCall('add', [new Reference($id), $priority]);
5252
}
5353
}
5454
}

src/DynamicRouter.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ class DynamicRouter implements RouterInterface, RequestMatcherInterface, Chained
5656
/**
5757
* @var RouteEnhancerInterface[][]
5858
*/
59-
protected $enhancers = array();
59+
protected $enhancers = [];
6060

6161
/**
6262
* Cached sorted list of enhancers.
6363
*
6464
* @var RouteEnhancerInterface[]
6565
*/
66-
protected $sortedEnhancers = array();
66+
protected $sortedEnhancers = [];
6767

6868
/**
6969
* The regexp pattern that needs to be matched before a dynamic lookup is
@@ -176,7 +176,7 @@ public function getGenerator()
176176
*
177177
* @api
178178
*/
179-
public function generate($name, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
179+
public function generate($name, $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
180180
{
181181
if ($this->eventDispatcher) {
182182
$event = new RouterGenerateEvent($name, $parameters, $referenceType);
@@ -316,11 +316,11 @@ protected function applyRouteEnhancers($defaults, Request $request)
316316
public function addRouteEnhancer(RouteEnhancerInterface $enhancer, $priority = 0)
317317
{
318318
if (empty($this->enhancers[$priority])) {
319-
$this->enhancers[$priority] = array();
319+
$this->enhancers[$priority] = [];
320320
}
321321

322322
$this->enhancers[$priority][] = $enhancer;
323-
$this->sortedEnhancers = array();
323+
$this->sortedEnhancers = [];
324324

325325
return $this;
326326
}
@@ -351,7 +351,7 @@ protected function sortRouteEnhancers()
351351
krsort($this->enhancers);
352352

353353
if (0 === count($this->enhancers)) {
354-
return array();
354+
return [];
355355
}
356356

357357
return call_user_func_array('array_merge', $this->enhancers);
@@ -386,7 +386,7 @@ public function getContext()
386386
*
387387
* Forwards to the generator.
388388
*/
389-
public function getRouteDebugMessage($name, array $parameters = array())
389+
public function getRouteDebugMessage($name, array $parameters = [])
390390
{
391391
if ($this->generator instanceof VersatileGeneratorInterface) {
392392
return $this->generator->getRouteDebugMessage($name, $parameters);

src/NestedMatcher/NestedMatcher.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ class NestedMatcher implements RequestMatcherInterface
5151
*
5252
* @var RouteFilterInterface[]
5353
*/
54-
protected $filters = array();
54+
protected $filters = [];
5555

5656
/**
5757
* Array of RouteFilterInterface objects, sorted.
5858
*
5959
* @var RouteFilterInterface[]
6060
*/
61-
protected $sortedFilters = array();
61+
protected $sortedFilters = [];
6262

6363
/**
6464
* Constructs a new NestedMatcher.
@@ -109,11 +109,11 @@ public function setRouteProvider(RouteProviderInterface $provider)
109109
public function addRouteFilter(RouteFilterInterface $filter, $priority = 0)
110110
{
111111
if (empty($this->filters[$priority])) {
112-
$this->filters[$priority] = array();
112+
$this->filters[$priority] = [];
113113
}
114114

115115
$this->filters[$priority][] = $filter;
116-
$this->sortedFilters = array();
116+
$this->sortedFilters = [];
117117

118118
return $this;
119119
}

0 commit comments

Comments
 (0)