Skip to content

Commit 25f39f6

Browse files
authored
Merge pull request #293 from FriendsOfSymfony/styleci
add styleci
2 parents ae3b2a7 + 3ebcbcf commit 25f39f6

Some content is hidden

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

58 files changed

+272
-239
lines changed

.styleci.yml

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

src/CacheInvalidator.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class CacheInvalidator
7676
private $headerLength = 7500;
7777

7878
/**
79-
* Constructor
79+
* Constructor.
8080
*
8181
* @param ProxyClientInterface $cache HTTP cache
8282
*/
@@ -112,12 +112,12 @@ public function supports($operation)
112112
case self::INVALIDATE:
113113
return $this->cache instanceof BanInterface;
114114
default:
115-
throw new InvalidArgumentException('Unknown operation ' . $operation);
115+
throw new InvalidArgumentException('Unknown operation '.$operation);
116116
}
117117
}
118118

119119
/**
120-
* Set event dispatcher
120+
* Set event dispatcher.
121121
*
122122
* @param EventDispatcherInterface $eventDispatcher
123123
*
@@ -136,7 +136,7 @@ public function setEventDispatcher(EventDispatcherInterface $eventDispatcher)
136136
}
137137

138138
/**
139-
* Get event dispatcher
139+
* Get event dispatcher.
140140
*
141141
* @return EventDispatcherInterface
142142
*/
@@ -150,7 +150,7 @@ public function getEventDispatcher()
150150
}
151151

152152
/**
153-
* Add subscriber
153+
* Add subscriber.
154154
*
155155
* @param EventSubscriberInterface $subscriber
156156
*
@@ -166,7 +166,7 @@ public function addSubscriber(EventSubscriberInterface $subscriber)
166166
}
167167

168168
/**
169-
* Set the HTTP header name that will hold cache tags
169+
* Set the HTTP header name that will hold cache tags.
170170
*
171171
* @param string $tagsHeader
172172
*
@@ -184,7 +184,7 @@ public function setTagsHeader($tagsHeader)
184184
}
185185

186186
/**
187-
* Get the HTTP header name that will hold cache tags
187+
* Get the HTTP header name that will hold cache tags.
188188
*
189189
* @return string
190190
*
@@ -196,7 +196,7 @@ public function getTagsHeader()
196196
}
197197

198198
/**
199-
* Invalidate a path or URL
199+
* Invalidate a path or URL.
200200
*
201201
* @param string $path Path or URL
202202
* @param array $headers HTTP headers (optional)
@@ -217,7 +217,7 @@ public function invalidatePath($path, array $headers = array())
217217
}
218218

219219
/**
220-
* Refresh a path or URL
220+
* Refresh a path or URL.
221221
*
222222
* @param string $path Path or URL
223223
* @param array $headers HTTP headers (optional)

src/Event.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Event extends BaseEvent
1818
private $exception;
1919

2020
/**
21-
* Set exception
21+
* Set exception.
2222
*
2323
* @param \Exception $exception
2424
*/
@@ -28,7 +28,7 @@ public function setException(\Exception $exception)
2828
}
2929

3030
/**
31-
* Get exception
31+
* Get exception.
3232
*
3333
* @return \Exception
3434
*/

src/EventListener/LogSubscriber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static function getSubscribedEvents()
3636
{
3737
return array(
3838
Events::PROXY_UNREACHABLE_ERROR => 'onProxyUnreachableError',
39-
Events::PROXY_RESPONSE_ERROR => 'onProxyResponseError'
39+
Events::PROXY_RESPONSE_ERROR => 'onProxyResponseError',
4040
);
4141
}
4242

@@ -53,7 +53,7 @@ public function onProxyResponseError(Event $event)
5353
private function log($level, \Exception $exception)
5454
{
5555
$context = array(
56-
'exception' => $exception
56+
'exception' => $exception,
5757
);
5858

5959
$this->logger->log($level, $exception->getMessage(), $context);

src/Events.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
namespace FOS\HttpCache;
1313

1414
/**
15-
* Events thrown by the FOSHttpCache library
15+
* Events thrown by the FOSHttpCache library.
1616
*/
1717
final class Events
1818
{
1919
const PROXY_UNREACHABLE_ERROR = 'fos_http_cache.error.proxy_unreachable';
20-
const PROXY_RESPONSE_ERROR = 'fos_http_cache.error.response';
20+
const PROXY_RESPONSE_ERROR = 'fos_http_cache.error.response';
2121
}

src/Exception/ExceptionCollection.php

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

1414
/**
1515
* A collection of exceptions that might occur during the flush operation of a
16-
* ProxyClientInterface implementation
16+
* ProxyClientInterface implementation.
1717
*/
18-
class ExceptionCollection extends \Exception implements \IteratorAggregate, \Countable, HttpCacheExceptionInterface
18+
class ExceptionCollection extends \Exception implements \IteratorAggregate, \Countable, HttpCacheExceptionInterface
1919
{
2020
private $exceptions = array();
2121

2222
/**
23-
* Add an exception to the collection
23+
* Add an exception to the collection.
2424
*
2525
* @param \Exception $e
2626
*
@@ -48,11 +48,11 @@ public function getFirst()
4848
return $this->exceptions[0];
4949
}
5050

51-
return null;
51+
return;
5252
}
5353

5454
/**
55-
* Get exception iterator
55+
* Get exception iterator.
5656
*
5757
* @return \ArrayIterator
5858
*/
@@ -62,7 +62,7 @@ public function getIterator()
6262
}
6363

6464
/**
65-
* Get number of exceptions in collection
65+
* Get number of exceptions in collection.
6666
*
6767
* @return int
6868
*/

src/Exception/HttpCacheExceptionInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
* Common interface for all exceptions thrown by this library.
1616
*/
1717
interface HttpCacheExceptionInterface
18-
{}
18+
{
19+
}

src/Exception/InvalidUrlException.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static function invalidUrl($url, $reason = null)
2929
$msg .= sprintf('Reason: %s', $reason);
3030
}
3131

32-
return new InvalidUrlException($msg);
32+
return new self($msg);
3333
}
3434

3535
/**
@@ -40,7 +40,7 @@ public static function invalidUrl($url, $reason = null)
4040
*/
4141
public static function invalidUrlParts($server, array $allowed)
4242
{
43-
return new InvalidUrlException(sprintf(
43+
return new self(sprintf(
4444
'Server "%s" is invalid. Only %s URL parts are allowed.',
4545
$server,
4646
implode(', ', $allowed)
@@ -56,7 +56,7 @@ public static function invalidUrlParts($server, array $allowed)
5656
*/
5757
public static function invalidUrlScheme($url, $scheme, array $allowed)
5858
{
59-
return new InvalidUrlException(sprintf(
59+
return new self(sprintf(
6060
'Host "%s" with scheme "%s" is invalid. Only schemes "%s" are supported',
6161
$url,
6262
$scheme,

src/Exception/MissingHostException.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ public static function missingHost($path)
2626
{
2727
$msg = sprintf(
2828
'Path "%s" cannot be invalidated without a host. '
29-
. 'Either invalidate full URLs containing hostnames instead of paths '
30-
. 'or configure the caching proxy class with a hostname in the base path.',
29+
.'Either invalidate full URLs containing hostnames instead of paths '
30+
.'or configure the caching proxy class with a hostname in the base path.',
3131
$path
3232
);
3333

34-
return new MissingHostException($msg);
34+
return new self($msg);
3535
}
3636
}

src/Exception/ProxyResponseException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ public static function proxyResponse($host, $statusCode, $statusMessage, $detail
3737
$message .= ". $details";
3838
}
3939

40-
return new ProxyResponseException($message, $statusCode, $previous);
40+
return new self($message, $statusCode, $previous);
4141
}
4242
}

0 commit comments

Comments
 (0)