Skip to content

Commit 1009876

Browse files
authored
Merge pull request #299 from FriendsOfSymfony/update-from-1.3
update master from 1.3
2 parents 9de1be9 + 9f76fdd commit 1009876

File tree

57 files changed

+360
-135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+360
-135
lines changed

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
preset: symfony

CacheManager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CacheManager extends CacheInvalidator
3737
private $generateUrlType = UrlGeneratorInterface::ABSOLUTE_PATH;
3838

3939
/**
40-
* Constructor
40+
* Constructor.
4141
*
4242
* @param ProxyClientInterface $cache HTTP cache proxy client
4343
* @param UrlGeneratorInterface $urlGenerator Symfony route generator
@@ -59,7 +59,7 @@ public function setGenerateUrlType($generateUrlType)
5959
}
6060

6161
/**
62-
* Assign cache tags to a response
62+
* Assign cache tags to a response.
6363
*
6464
* @param Response $response
6565
* @param array $tags
@@ -91,7 +91,7 @@ public function tagResponse(Response $response, array $tags, $replace = false)
9191
}
9292

9393
/**
94-
* Invalidate a route
94+
* Invalidate a route.
9595
*
9696
* @param string $name Route name
9797
* @param array $parameters Route parameters (optional)
@@ -107,7 +107,7 @@ public function invalidateRoute($name, array $parameters = array(), array $heade
107107
}
108108

109109
/**
110-
* Refresh a route
110+
* Refresh a route.
111111
*
112112
* @param string $route Route name
113113
* @param array $parameters Route parameters (optional)

Command/InvalidatePathCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(CacheManager $cacheManager = null, $commandName = 'f
4242
}
4343

4444
/**
45-
* {@inheritDoc}
45+
* {@inheritdoc}
4646
*/
4747
protected function configure()
4848
{
@@ -54,7 +54,7 @@ protected function configure()
5454
InputArgument::IS_ARRAY | InputArgument::REQUIRED,
5555
'URL paths you want to invalidate, you can specify any number of paths'
5656
)
57-
->setHelp(<<<EOF
57+
->setHelp(<<<'EOF'
5858
The <info>%command.name%</info> command invalidates a list of paths on the configured caching proxies.
5959
6060
Example:
@@ -66,7 +66,7 @@ protected function configure()
6666
}
6767

6868
/**
69-
* {@inheritDoc}
69+
* {@inheritdoc}
7070
*/
7171
protected function execute(InputInterface $input, OutputInterface $output)
7272
{

Command/InvalidateRegexCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(CacheManager $cacheManager = null, $commandName = 'f
4343
}
4444

4545
/**
46-
* {@inheritDoc}
46+
* {@inheritdoc}
4747
*/
4848
protected function configure()
4949
{
@@ -55,7 +55,7 @@ protected function configure()
5555
InputArgument::REQUIRED,
5656
'Regular expression for the paths to match.'
5757
)
58-
->setHelp(<<<EOF
58+
->setHelp(<<<'EOF'
5959
The <info>%command.name%</info> command invalidates all cached content matching a regular expression on the configured caching proxies.
6060
6161
Example:
@@ -71,7 +71,7 @@ protected function configure()
7171
}
7272

7373
/**
74-
* {@inheritDoc}
74+
* {@inheritdoc}
7575
*/
7676
protected function execute(InputInterface $input, OutputInterface $output)
7777
{

Command/InvalidateTagCommand.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,14 @@ public function __construct($tagHandler = null, $commandName = 'fos:httpcache:in
5656
}
5757
if ($tagHandler instanceof CacheManager) {
5858
@trigger_error('Passing the CacheManager to '.__CLASS__.' is deprecated since version 1.2 and will be removed in 2.0. Provide the TagHandler instead.', E_USER_DEPRECATED);
59-
6059
}
6160
$this->commandName = $commandName;
6261
$this->tagHandler = $tagHandler;
6362
parent::__construct();
6463
}
6564

6665
/**
67-
* {@inheritDoc}
66+
* {@inheritdoc}
6867
*/
6968
protected function configure()
7069
{
@@ -76,7 +75,7 @@ protected function configure()
7675
InputArgument::IS_ARRAY | InputArgument::REQUIRED,
7776
'Tags in the response tags header to invalidate'
7877
)
79-
->setHelp(<<<EOF
78+
->setHelp(<<<'EOF'
8079
The <info>%command.name%</info> command invalidates all cached content matching the specified tags on the configured caching proxies.
8180
8281
Example:
@@ -88,7 +87,7 @@ protected function configure()
8887
}
8988

9089
/**
91-
* {@inheritDoc}
90+
* {@inheritdoc}
9291
*/
9392
protected function execute(InputInterface $input, OutputInterface $output)
9493
{

Command/RefreshPathCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(CacheManager $cacheManager = null, $commandName = 'f
4242
}
4343

4444
/**
45-
* {@inheritDoc}
45+
* {@inheritdoc}
4646
*/
4747
protected function configure()
4848
{
@@ -54,7 +54,7 @@ protected function configure()
5454
InputArgument::IS_ARRAY | InputArgument::REQUIRED,
5555
'URL paths you want to refresh, you can specify any number of paths'
5656
)
57-
->setHelp(<<<EOF
57+
->setHelp(<<<'EOF'
5858
The <info>%command.name%</info> command refreshes a list of paths on the configured caching proxies.
5959
6060
Example:
@@ -66,7 +66,7 @@ protected function configure()
6666
}
6767

6868
/**
69-
* {@inheritDoc}
69+
* {@inheritdoc}
7070
*/
7171
protected function execute(InputInterface $input, OutputInterface $output)
7272
{

DependencyInjection/Compiler/HashGeneratorPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
use Symfony\Component\DependencyInjection\Reference;
1818

1919
/**
20-
* Add tagged provider to the hash generator for user context
20+
* Add tagged provider to the hash generator for user context.
2121
*/
2222
class HashGeneratorPass implements CompilerPassInterface
2323
{
24-
const TAG_NAME = "fos_http_cache.user_context_provider";
24+
const TAG_NAME = 'fos_http_cache.user_context_provider';
2525

2626
/**
2727
* {@inheritdoc}
@@ -43,7 +43,7 @@ public function process(ContainerBuilder $container)
4343

4444
foreach ($taggedProviders as $id => $tags) {
4545
foreach ($tags as $tag) {
46-
$priority = isset($tag['priority']) ? (int)$tag['priority'] : 0;
46+
$priority = isset($tag['priority']) ? (int) $tag['priority'] : 0;
4747
$prioritisedTags[$priority][] = $id;
4848
}
4949
}

DependencyInjection/Compiler/LoggerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
1616

1717
/**
18-
* Attach Symfony2 logger to cache manager
18+
* Attach Symfony2 logger to cache manager.
1919
*/
2020
class LoggerPass implements CompilerPassInterface
2121
{

DependencyInjection/Compiler/SecurityContextPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use Symfony\Component\DependencyInjection\Reference;
1717

1818
/**
19-
* In Symfony < 2.6, replace the new security.token_storage service with the
20-
* deprecated security.context service.
19+
* In Symfony < 2.6, replace the new security.token_storage service with the
20+
* deprecated security.context service.
2121
*/
2222
class SecurityContextPass implements CompilerPassInterface
2323
{

DependencyInjection/Compiler/TagSubscriberPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
1616

1717
/**
18-
* Check for required ControllerListener if TagSubscriber is enabled
18+
* Check for required ControllerListener if TagSubscriber is enabled.
1919
*/
2020
class TagSubscriberPass implements CompilerPassInterface
2121
{

DependencyInjection/Configuration.php

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2020

2121
/**
22-
* This class contains the configuration information for the bundle
22+
* This class contains the configuration information for the bundle.
2323
*
2424
* This information is solely responsible for how the different configuration
2525
* sections are normalized, and merged.
@@ -35,15 +35,15 @@ class Configuration implements ConfigurationInterface
3535
private $debug;
3636

3737
/**
38-
* @param Boolean $debug Whether to use the debug mode
38+
* @param bool $debug Whether to use the debug mode
3939
*/
4040
public function __construct($debug)
4141
{
4242
$this->debug = $debug;
4343
}
4444

4545
/**
46-
* {@inheritDoc}
46+
* {@inheritdoc}
4747
*/
4848
public function getConfigTreeBuilder()
4949
{
@@ -68,7 +68,9 @@ public function getConfigTreeBuilder()
6868
})
6969
->end()
7070
->validate()
71-
->ifTrue(function ($v) {return $v['tags']['enabled'] && !$v['cache_manager']['enabled'];})
71+
->ifTrue(function ($v) {
72+
return $v['tags']['enabled'] && !$v['cache_manager']['enabled'];
73+
})
7274
->then(function ($v) {
7375
if ('auto' === $v['tags']['enabled']) {
7476
$v['tags']['enabled'] = false;
@@ -79,7 +81,9 @@ public function getConfigTreeBuilder()
7981
})
8082
->end()
8183
->validate()
82-
->ifTrue(function ($v) {return $v['invalidation']['enabled'] && !$v['cache_manager']['enabled'];})
84+
->ifTrue(function ($v) {
85+
return $v['invalidation']['enabled'] && !$v['cache_manager']['enabled'];
86+
})
8387
->then(function ($v) {
8488
if ('auto' === $v['invalidation']['enabled']) {
8589
$v['invalidation']['enabled'] = false;
@@ -94,7 +98,7 @@ public function getConfigTreeBuilder()
9498
return isset($v['test'])
9599
&& $v['test']['client']['varnish']['enabled']
96100
&& !isset($v['proxy_client']['varnish']);
97-
})
101+
})
98102
->then(function ($v) {
99103
if ('auto' === $v['test']['client']['varnish']['enabled']) {
100104
$v['test']['client']['varnish']['enabled'] = false;
@@ -222,7 +226,9 @@ private function addCacheControlSection(ArrayNodeDefinition $rootNode)
222226
->info('Specify an X-Reverse-Proxy-TTL header with a time in seconds for a caching proxy under your control.')
223227
->end()
224228
->arrayNode('vary')
225-
->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end()
229+
->beforeNormalization()->ifString()->then(function ($v) {
230+
return preg_split('/\s*,\s*/', $v);
231+
})->end()
226232
->prototype('scalar')->end()
227233
->info('Define a list of additional headers on which the response varies.')
228234
->end()
@@ -246,11 +252,15 @@ private function addMatch(NodeBuilder $rules)
246252
->fixXmlConfig('ip')
247253
->fixXmlConfig('attribute')
248254
->validate()
249-
->ifTrue(function ($v) {return !empty($v['additional_cacheable_status']) && !empty($v['match_response']);})
255+
->ifTrue(function ($v) {
256+
return !empty($v['additional_cacheable_status']) && !empty($v['match_response']);
257+
})
250258
->thenInvalid('You may not set both additional_cacheable_status and match_response.')
251259
->end()
252260
->validate()
253-
->ifTrue(function ($v) {return !empty($v['match_response']) && !class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage');})
261+
->ifTrue(function ($v) {
262+
return !empty($v['match_response']) && !class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage');
263+
})
254264
->thenInvalid('Configured a match_response but ExpressionLanguage is not available')
255265
->end()
256266
->children()
@@ -263,13 +273,17 @@ private function addMatch(NodeBuilder $rules)
263273
->info('Request host name.')
264274
->end()
265275
->arrayNode('methods')
266-
->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end()
276+
->beforeNormalization()->ifString()->then(function ($v) {
277+
return preg_split('/\s*,\s*/', $v);
278+
})->end()
267279
->useAttributeAsKey('name')
268280
->prototype('scalar')->end()
269281
->info('Request HTTP methods.')
270282
->end()
271283
->arrayNode('ips')
272-
->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end()
284+
->beforeNormalization()->ifString()->then(function ($v) {
285+
return preg_split('/\s*,\s*/', $v);
286+
})->end()
273287
->useAttributeAsKey('name')
274288
->prototype('scalar')->end()
275289
->info('List of client IPs.')
@@ -306,7 +320,9 @@ private function addProxyClientSection(ArrayNodeDefinition $rootNode)
306320
->fixXmlConfig('server')
307321
->children()
308322
->arrayNode('servers')
309-
->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end()
323+
->beforeNormalization()->ifString()->then(function ($v) {
324+
return preg_split('/\s*,\s*/', $v);
325+
})->end()
310326
->useAttributeAsKey('name')
311327
->isRequired()
312328
->requiresAtLeastOneElement()
@@ -328,7 +344,9 @@ private function addProxyClientSection(ArrayNodeDefinition $rootNode)
328344
->fixXmlConfig('server')
329345
->children()
330346
->arrayNode('servers')
331-
->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end()
347+
->beforeNormalization()->ifString()->then(function ($v) {
348+
return preg_split('/\s*,\s*/', $v);
349+
})->end()
332350
->useAttributeAsKey('name')
333351
->isRequired()
334352
->requiresAtLeastOneElement()
@@ -354,7 +372,9 @@ private function addProxyClientSection(ArrayNodeDefinition $rootNode)
354372
->fixXmlConfig('server')
355373
->children()
356374
->arrayNode('servers')
357-
->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end()
375+
->beforeNormalization()->ifString()->then(function ($v) {
376+
return preg_split('/\s*,\s*/', $v);
377+
})->end()
358378
->useAttributeAsKey('name')
359379
->isRequired()
360380
->requiresAtLeastOneElement()
@@ -449,7 +469,7 @@ private function addTestSection(ArrayNodeDefinition $rootNode)
449469
}
450470

451471
/**
452-
* Cache manager main section
472+
* Cache manager main section.
453473
*
454474
* @param ArrayNodeDefinition $rootNode
455475
*/
@@ -518,7 +538,9 @@ private function addTagSection(ArrayNodeDefinition $rootNode)
518538
->fixXmlConfig('tag')
519539
->fixXmlConfig('tag_expression')
520540
->validate()
521-
->ifTrue(function ($v) {return !empty($v['tag_expressions']) && !class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage');})
541+
->ifTrue(function ($v) {
542+
return !empty($v['tag_expressions']) && !class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage');
543+
})
522544
->thenInvalid('Configured a tag_expression but ExpressionLanugage is not available')
523545
->end()
524546
->children();

DependencyInjection/FOSHttpCacheExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
class FOSHttpCacheExtension extends Extension
2828
{
2929
/**
30-
* {@inheritDoc}
30+
* {@inheritdoc}
3131
*/
3232
public function getConfiguration(array $config, ContainerBuilder $container)
3333
{
3434
return new Configuration($container->getParameter('kernel.debug'));
3535
}
3636

3737
/**
38-
* {@inheritDoc}
38+
* {@inheritdoc}
3939
*/
4040
public function load(array $configs, ContainerBuilder $container)
4141
{

0 commit comments

Comments
 (0)