Skip to content

Commit 944b859

Browse files
committed
use php-cs-fixer
1 parent 853028c commit 944b859

17 files changed

+77
-52
lines changed

.github/workflows/static.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
pull_request:
88

99
jobs:
10-
phpstan:
10+
phpstan-src:
1111
name: PHPStan src
1212
runs-on: ubuntu-latest
1313

@@ -44,3 +44,16 @@ jobs:
4444
uses: docker://oskarstark/phpstan-ga
4545
with:
4646
args: analyze --no-progress -c phpstan.tests.neon.dist
47+
48+
php-cs-fixer:
49+
name: PHP-CS-Fixer
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v2
55+
56+
- name: PHP-CS-Fixer
57+
uses: docker://oskarstark/php-cs-fixer-ga
58+
with:
59+
args: --dry-run --diff

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ vendor/
22
composer.lock
33
phpunit.xml
44
doc/_build/
5+
.php-cs-fixer.cache
56
puli.json
67
.puli/

.php-cs-fixer.dist.php

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__.'/src')
5+
->in(__DIR__.'/tests')
6+
->name('*.php')
7+
;
8+
9+
$config = new PhpCsFixer\Config();
10+
11+
return $config
12+
->setRiskyAllowed(true)
13+
->setRules([
14+
'@Symfony' => true,
15+
'single_line_throw' => false,
16+
])
17+
->setFinder($finder)
18+
;

.styleci.yml

-7
This file was deleted.

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ Changelog
33

44
See also the [GitHub releases page](https://github.com/FriendsOfSymfony/FOSHttpCache/releases).
55

6+
2.11.0
7+
------
8+
9+
### Fastly client
10+
11+
- Marked the `@internal` constants in `FOS\HttpCache\ProxyClient\Fastly` as private
12+
613
2.10.1
714
------
815

src/CacheInvalidator.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,27 @@ class CacheInvalidator
4040
/**
4141
* Value to check support of invalidatePath operation.
4242
*/
43-
const PATH = 'path';
43+
public const PATH = 'path';
4444

4545
/**
4646
* Value to check support of refreshPath operation.
4747
*/
48-
const REFRESH = 'refresh';
48+
public const REFRESH = 'refresh';
4949

5050
/**
5151
* Value to check support of invalidate and invalidateRegex operations.
5252
*/
53-
const INVALIDATE = 'invalidate';
53+
public const INVALIDATE = 'invalidate';
5454

5555
/**
5656
* Value to check support of invalidateTags operation.
5757
*/
58-
const TAGS = 'tags';
58+
public const TAGS = 'tags';
5959

6060
/**
6161
* Value to check support of clearCache operation.
6262
*/
63-
const CLEAR = 'clear';
63+
public const CLEAR = 'clear';
6464

6565
/**
6666
* @var ProxyClient

src/Events.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
final class Events
1818
{
19-
const PROXY_UNREACHABLE_ERROR = 'fos_http_cache.error.proxy_unreachable';
19+
public const PROXY_UNREACHABLE_ERROR = 'fos_http_cache.error.proxy_unreachable';
2020

21-
const PROXY_RESPONSE_ERROR = 'fos_http_cache.error.response';
21+
public const PROXY_RESPONSE_ERROR = 'fos_http_cache.error.response';
2222
}

src/ProxyClient/Fastly.php

+3-10
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,17 @@
3232
*/
3333
class Fastly extends HttpProxyClient implements ClearCapable, PurgeCapable, RefreshCapable, TagCapable
3434
{
35-
/**
36-
* @internal
37-
*/
38-
const HTTP_METHOD_PURGE = 'PURGE';
35+
private const HTTP_METHOD_PURGE = 'PURGE';
3936

4037
/**
41-
* @internal
42-
*
4338
* @see https://docs.fastly.com/api/purge#purge_db35b293f8a724717fcf25628d713583 Fastly's limit on batch tag purges.
4439
*/
45-
const TAG_BATCH_PURGE_LIMIT = 256;
40+
private const TAG_BATCH_PURGE_LIMIT = 256;
4641

4742
/**
48-
* @internal
49-
*
5043
* @see https://docs.fastly.com/api/purge Base url endpoint used on anything but url PURGE/GET/HEAD.
5144
*/
52-
const API_ENDPOINT = 'https://api.fastly.com';
45+
private const API_ENDPOINT = 'https://api.fastly.com';
5346

5447
/**
5548
* {@inheritdoc}

src/ProxyClient/Invalidation/BanCapable.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
*/
2020
interface BanCapable extends ProxyClient
2121
{
22-
const REGEX_MATCH_ALL = '.*';
22+
public const REGEX_MATCH_ALL = '.*';
2323

24-
const CONTENT_TYPE_ALL = self::REGEX_MATCH_ALL;
24+
public const CONTENT_TYPE_ALL = self::REGEX_MATCH_ALL;
2525

2626
/**
2727
* Ban cached objects matching HTTP headers.

src/ProxyClient/Nginx.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
*/
2626
class Nginx extends HttpProxyClient implements PurgeCapable, RefreshCapable
2727
{
28-
const HTTP_METHOD_PURGE = 'PURGE';
28+
public const HTTP_METHOD_PURGE = 'PURGE';
2929

30-
const HTTP_METHOD_REFRESH = 'GET';
30+
public const HTTP_METHOD_REFRESH = 'GET';
3131

32-
const HTTP_HEADER_REFRESH = 'X-Refresh';
32+
public const HTTP_HEADER_REFRESH = 'X-Refresh';
3333

3434
/**
3535
* {@inheritdoc}

src/ProxyClient/Symfony.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*/
3030
class Symfony extends HttpProxyClient implements PurgeCapable, RefreshCapable, TagCapable, ClearCapable
3131
{
32-
const HTTP_METHOD_REFRESH = 'GET';
32+
public const HTTP_METHOD_REFRESH = 'GET';
3333

3434
/**
3535
* {@inheritdoc}

src/ProxyClient/Varnish.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,23 @@
3737
*/
3838
class Varnish extends HttpProxyClient implements BanCapable, PurgeCapable, RefreshCapable, TagCapable
3939
{
40-
const HTTP_METHOD_BAN = 'BAN';
40+
public const HTTP_METHOD_BAN = 'BAN';
4141

42-
const HTTP_METHOD_PURGE = 'PURGE';
42+
public const HTTP_METHOD_PURGE = 'PURGE';
4343

44-
const HTTP_METHOD_PURGEKEYS = 'PURGEKEYS';
44+
public const HTTP_METHOD_PURGEKEYS = 'PURGEKEYS';
4545

46-
const HTTP_METHOD_REFRESH = 'GET';
46+
public const HTTP_METHOD_REFRESH = 'GET';
4747

48-
const HTTP_HEADER_HOST = 'X-Host';
48+
public const HTTP_HEADER_HOST = 'X-Host';
4949

50-
const HTTP_HEADER_URL = 'X-Url';
50+
public const HTTP_HEADER_URL = 'X-Url';
5151

52-
const HTTP_HEADER_CONTENT_TYPE = 'X-Content-Type';
52+
public const HTTP_HEADER_CONTENT_TYPE = 'X-Content-Type';
5353

54-
const TAG_BAN = 'ban';
54+
public const TAG_BAN = 'ban';
5555

56-
const TAG_XKEY = 'purgekeys';
56+
public const TAG_XKEY = 'purgekeys';
5757

5858
/**
5959
* Default name of the header used to invalidate content with specific tags.
@@ -63,9 +63,9 @@ class Varnish extends HttpProxyClient implements BanCapable, PurgeCapable, Refre
6363
*
6464
* @var string
6565
*/
66-
const DEFAULT_HTTP_HEADER_CACHE_TAGS = 'X-Cache-Tags';
66+
public const DEFAULT_HTTP_HEADER_CACHE_TAGS = 'X-Cache-Tags';
6767

68-
const DEFAULT_HTTP_HEADER_CACHE_XKEY = 'xkey-softpurge';
68+
public const DEFAULT_HTTP_HEADER_CACHE_XKEY = 'xkey-softpurge';
6969

7070
/**
7171
* {@inheritdoc}

src/SymfonyCache/CustomTtlListener.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CustomTtlListener implements EventSubscriberInterface
3535
*
3636
* @var string
3737
*/
38-
const SMAXAGE_BACKUP = 'FOS-Smaxage-Backup';
38+
public const SMAXAGE_BACKUP = 'FOS-Smaxage-Backup';
3939

4040
/**
4141
* @param string $ttlHeader The header that is used to specify the TTL header

src/SymfonyCache/Events.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
*/
1717
final class Events
1818
{
19-
const PRE_HANDLE = 'fos_http_cache.pre_handle';
19+
public const PRE_HANDLE = 'fos_http_cache.pre_handle';
2020

21-
const POST_HANDLE = 'fos_http_cache.post_handle';
21+
public const POST_HANDLE = 'fos_http_cache.post_handle';
2222

23-
const PRE_INVALIDATE = 'fos_http_cache.pre_invalidate';
23+
public const PRE_INVALIDATE = 'fos_http_cache.pre_invalidate';
2424

25-
const PRE_STORE = 'fos_http_cache.pre_store';
25+
public const PRE_STORE = 'fos_http_cache.pre_store';
2626
}

src/SymfonyCache/PurgeListener.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
*/
2626
class PurgeListener extends AccessControlledListener
2727
{
28-
const DEFAULT_PURGE_METHOD = 'PURGE';
28+
public const DEFAULT_PURGE_METHOD = 'PURGE';
2929

30-
const DEFAULT_CLEAR_CACHE_HEADER = 'Clear-Cache';
30+
public const DEFAULT_CLEAR_CACHE_HEADER = 'Clear-Cache';
3131

3232
/**
3333
* The purge method to use.

src/SymfonyCache/PurgeTagsListener.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
*/
2525
class PurgeTagsListener extends AccessControlledListener
2626
{
27-
const DEFAULT_TAGS_METHOD = 'PURGETAGS';
27+
public const DEFAULT_TAGS_METHOD = 'PURGETAGS';
2828

29-
const DEFAULT_TAGS_HEADER = 'X-Cache-Tags';
29+
public const DEFAULT_TAGS_HEADER = 'X-Cache-Tags';
3030

3131
/**
3232
* The purge tags method to use.

src/TagHeaderFormatter/TagHeaderFormatter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface TagHeaderFormatter
2323
*
2424
* @var string
2525
*/
26-
const DEFAULT_HEADER_NAME = 'X-Cache-Tags';
26+
public const DEFAULT_HEADER_NAME = 'X-Cache-Tags';
2727

2828
/**
2929
* Get the HTTP header name that will hold cache tags.

0 commit comments

Comments
 (0)