Skip to content

Commit 58f763c

Browse files
authored
Merge pull request #347 from FriendsOfSymfony/style
additional style instructions
2 parents bc26dee + 7ff5d0a commit 58f763c

File tree

13 files changed

+44
-40
lines changed

13 files changed

+44
-40
lines changed

.styleci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
preset: symfony
2+
3+
enabled:
4+
- alpha_ordered_imports
5+
- short_array_syntax

src/CacheInvalidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
use FOS\HttpCache\Exception\ProxyResponseException;
1717
use FOS\HttpCache\Exception\ProxyUnreachableException;
1818
use FOS\HttpCache\Exception\UnsupportedProxyOperationException;
19-
use FOS\HttpCache\ProxyClient\ProxyClient;
20-
use FOS\HttpCache\ProxyClient\Invalidation\TagCapable;
2119
use FOS\HttpCache\ProxyClient\Invalidation\BanCapable;
2220
use FOS\HttpCache\ProxyClient\Invalidation\PurgeCapable;
2321
use FOS\HttpCache\ProxyClient\Invalidation\RefreshCapable;
22+
use FOS\HttpCache\ProxyClient\Invalidation\TagCapable;
23+
use FOS\HttpCache\ProxyClient\ProxyClient;
2424
use Symfony\Component\EventDispatcher\EventDispatcher;
2525
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
2626

src/ProxyClient/MultiplexerClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function invalidateTags(array $tags)
138138
*
139139
* @return $this
140140
*/
141-
public function purge($url, array $headers = array())
141+
public function purge($url, array $headers = [])
142142
{
143143
$this->invoke(PurgeCapable::class, 'purge', [$url, $headers]);
144144

src/ResponseTagger.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ class ResponseTagger
5151
* @param TagCapable $proxyClient
5252
* @param array $options
5353
*/
54-
public function __construct(TagCapable $proxyClient, array $options = array())
54+
public function __construct(TagCapable $proxyClient, array $options = [])
5555
{
5656
$this->proxyClient = $proxyClient;
5757

5858
$resolver = new OptionsResolver();
59-
$resolver->setDefaults(array(
59+
$resolver->setDefaults([
6060
'strict' => false,
61-
));
61+
]);
6262

6363
$resolver->setAllowedTypes('strict', 'bool');
6464

src/SymfonyCache/CustomTtlListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ public function cleanResponse(CacheEvent $e)
9898
*/
9999
public static function getSubscribedEvents()
100100
{
101-
return array(
101+
return [
102102
Events::PRE_STORE => 'useCustomTtl',
103103
Events::POST_HANDLE => 'cleanResponse',
104-
);
104+
];
105105
}
106106
}

src/Test/EventDispatchingHttpCacheTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
namespace FOS\HttpCache\Test;
1313

14+
use FOS\HttpCache\SymfonyCache\CacheEvent;
1415
use FOS\HttpCache\SymfonyCache\CacheInvalidation;
1516
use FOS\HttpCache\SymfonyCache\EventDispatchingHttpCache;
16-
use FOS\HttpCache\SymfonyCache\CacheEvent;
1717
use FOS\HttpCache\SymfonyCache\Events;
1818
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1919
use Symfony\Component\HttpFoundation\Request;

src/Test/HttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
namespace FOS\HttpCache\Test;
1313

14+
use Http\Client\HttpClient as PhpHttpClient;
1415
use Http\Discovery\HttpClientDiscovery;
1516
use Http\Discovery\MessageFactoryDiscovery;
1617
use Http\Discovery\UriFactoryDiscovery;
17-
use Http\Client\HttpClient as PhpHttpClient;
1818
use Psr\Http\Message\RequestInterface;
1919
use Psr\Http\Message\ResponseInterface;
2020
use Psr\Http\Message\UriInterface;

tests/Functional/Fixtures/Symfony/AppCache.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414
use FOS\HttpCache\SymfonyCache\CacheInvalidation;
1515
use FOS\HttpCache\SymfonyCache\CustomTtlListener;
16-
use FOS\HttpCache\SymfonyCache\EventDispatchingHttpCache;
17-
use Symfony\Component\HttpFoundation\Request;
18-
use Symfony\Component\HttpKernel\HttpCache\HttpCache;
1916
use FOS\HttpCache\SymfonyCache\DebugListener;
17+
use FOS\HttpCache\SymfonyCache\EventDispatchingHttpCache;
2018
use FOS\HttpCache\SymfonyCache\PurgeListener;
2119
use FOS\HttpCache\SymfonyCache\RefreshListener;
2220
use FOS\HttpCache\SymfonyCache\UserContextListener;
21+
use Symfony\Component\HttpFoundation\Request;
22+
use Symfony\Component\HttpKernel\HttpCache\HttpCache;
2323
use Symfony\Component\HttpKernel\HttpCache\StoreInterface;
2424
use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface;
2525
use Symfony\Component\HttpKernel\HttpKernelInterface;
@@ -28,7 +28,7 @@ class AppCache extends HttpCache implements CacheInvalidation
2828
{
2929
use EventDispatchingHttpCache;
3030

31-
public function __construct(HttpKernelInterface $kernel, StoreInterface $store, SurrogateInterface $surrogate = null, array $options = array())
31+
public function __construct(HttpKernelInterface $kernel, StoreInterface $store, SurrogateInterface $surrogate = null, array $options = [])
3232
{
3333
parent::__construct($kernel, $store, $surrogate, $options);
3434

tests/Unit/ProxyClient/HttpDispatcherTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
use FOS\HttpCache\Exception\ProxyUnreachableException;
1818
use FOS\HttpCache\ProxyClient\HttpDispatcher;
1919
use Http\Client\Exception\HttpException;
20+
use Http\Client\Exception\RequestException;
2021
use Http\Client\HttpAsyncClient;
22+
use Http\Discovery\MessageFactoryDiscovery;
2123
use Http\Discovery\UriFactoryDiscovery;
2224
use Http\Message\MessageFactory;
2325
use Http\Message\UriFactory;
2426
use Http\Mock\Client;
25-
use Http\Client\Exception\RequestException;
26-
use Http\Discovery\MessageFactoryDiscovery;
2727
use Http\Promise\Promise;
2828
use Psr\Http\Message\RequestInterface;
2929
use Psr\Http\Message\ResponseInterface;

tests/Unit/ResponseTaggerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
namespace FOS\HttpCache\Tests\Unit;
1313

14+
use FOS\HttpCache\Exception\InvalidTagException;
1415
use FOS\HttpCache\ProxyClient\HttpDispatcher;
1516
use FOS\HttpCache\ProxyClient\Invalidation\TagCapable;
16-
use FOS\HttpCache\ResponseTagger;
1717
use FOS\HttpCache\ProxyClient\Varnish;
18-
use FOS\HttpCache\Exception\InvalidTagException;
18+
use FOS\HttpCache\ResponseTagger;
1919
use Psr\Http\Message\ResponseInterface;
2020

2121
class ResponseTaggerTest extends \PHPUnit_Framework_TestCase
@@ -104,10 +104,10 @@ public function testStrictEmptyTag()
104104
$httpAdapter = new HttpDispatcher(['localhost'], 'localhost');
105105
$proxyClient = new Varnish($httpAdapter);
106106

107-
$tagHandler = new ResponseTagger($proxyClient, array('strict' => true));
107+
$tagHandler = new ResponseTagger($proxyClient, ['strict' => true]);
108108

109109
try {
110-
$tagHandler->addTags(array('post-1', false));
110+
$tagHandler->addTags(['post-1', false]);
111111
$this->fail('Expected exception');
112112
} catch (InvalidTagException $e) {
113113
// success
@@ -124,7 +124,7 @@ public function testNonStrictEmptyTag()
124124
->getMock();
125125

126126
$tagHandler = new ResponseTagger($proxyClient);
127-
$tagHandler->addTags(array('post-1', false, null, ''));
127+
$tagHandler->addTags(['post-1', false, null, '']);
128128
$this->assertTrue($tagHandler->hasTags());
129129
$this->assertEquals('post-1', $tagHandler->getTagsHeaderValue());
130130
}

0 commit comments

Comments
 (0)