Skip to content

Commit

Permalink
use php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Jul 7, 2021
1 parent 853028c commit 944b859
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 52 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

jobs:
phpstan:
phpstan-src:
name: PHPStan src
runs-on: ubuntu-latest

Expand Down Expand Up @@ -44,3 +44,16 @@ jobs:
uses: docker://oskarstark/phpstan-ga
with:
args: analyze --no-progress -c phpstan.tests.neon.dist

php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --dry-run --diff
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ vendor/
composer.lock
phpunit.xml
doc/_build/
.php-cs-fixer.cache
puli.json
.puli/
18 changes: 18 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->name('*.php')
;

$config = new PhpCsFixer\Config();

return $config
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'single_line_throw' => false,
])
->setFinder($finder)
;
7 changes: 0 additions & 7 deletions .styleci.yml

This file was deleted.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ Changelog

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

2.11.0
------

### Fastly client

- Marked the `@internal` constants in `FOS\HttpCache\ProxyClient\Fastly` as private

2.10.1
------

Expand Down
10 changes: 5 additions & 5 deletions src/CacheInvalidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@ class CacheInvalidator
/**
* Value to check support of invalidatePath operation.
*/
const PATH = 'path';
public const PATH = 'path';

/**
* Value to check support of refreshPath operation.
*/
const REFRESH = 'refresh';
public const REFRESH = 'refresh';

/**
* Value to check support of invalidate and invalidateRegex operations.
*/
const INVALIDATE = 'invalidate';
public const INVALIDATE = 'invalidate';

/**
* Value to check support of invalidateTags operation.
*/
const TAGS = 'tags';
public const TAGS = 'tags';

/**
* Value to check support of clearCache operation.
*/
const CLEAR = 'clear';
public const CLEAR = 'clear';

/**
* @var ProxyClient
Expand Down
4 changes: 2 additions & 2 deletions src/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
final class Events
{
const PROXY_UNREACHABLE_ERROR = 'fos_http_cache.error.proxy_unreachable';
public const PROXY_UNREACHABLE_ERROR = 'fos_http_cache.error.proxy_unreachable';

const PROXY_RESPONSE_ERROR = 'fos_http_cache.error.response';
public const PROXY_RESPONSE_ERROR = 'fos_http_cache.error.response';
}
13 changes: 3 additions & 10 deletions src/ProxyClient/Fastly.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,17 @@
*/
class Fastly extends HttpProxyClient implements ClearCapable, PurgeCapable, RefreshCapable, TagCapable
{
/**
* @internal
*/
const HTTP_METHOD_PURGE = 'PURGE';
private const HTTP_METHOD_PURGE = 'PURGE';

/**
* @internal
*
* @see https://docs.fastly.com/api/purge#purge_db35b293f8a724717fcf25628d713583 Fastly's limit on batch tag purges.
*/
const TAG_BATCH_PURGE_LIMIT = 256;
private const TAG_BATCH_PURGE_LIMIT = 256;

/**
* @internal
*
* @see https://docs.fastly.com/api/purge Base url endpoint used on anything but url PURGE/GET/HEAD.
*/
const API_ENDPOINT = 'https://api.fastly.com';
private const API_ENDPOINT = 'https://api.fastly.com';

/**
* {@inheritdoc}
Expand Down
4 changes: 2 additions & 2 deletions src/ProxyClient/Invalidation/BanCapable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
*/
interface BanCapable extends ProxyClient
{
const REGEX_MATCH_ALL = '.*';
public const REGEX_MATCH_ALL = '.*';

const CONTENT_TYPE_ALL = self::REGEX_MATCH_ALL;
public const CONTENT_TYPE_ALL = self::REGEX_MATCH_ALL;

/**
* Ban cached objects matching HTTP headers.
Expand Down
6 changes: 3 additions & 3 deletions src/ProxyClient/Nginx.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
*/
class Nginx extends HttpProxyClient implements PurgeCapable, RefreshCapable
{
const HTTP_METHOD_PURGE = 'PURGE';
public const HTTP_METHOD_PURGE = 'PURGE';

const HTTP_METHOD_REFRESH = 'GET';
public const HTTP_METHOD_REFRESH = 'GET';

const HTTP_HEADER_REFRESH = 'X-Refresh';
public const HTTP_HEADER_REFRESH = 'X-Refresh';

/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion src/ProxyClient/Symfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
class Symfony extends HttpProxyClient implements PurgeCapable, RefreshCapable, TagCapable, ClearCapable
{
const HTTP_METHOD_REFRESH = 'GET';
public const HTTP_METHOD_REFRESH = 'GET';

/**
* {@inheritdoc}
Expand Down
22 changes: 11 additions & 11 deletions src/ProxyClient/Varnish.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@
*/
class Varnish extends HttpProxyClient implements BanCapable, PurgeCapable, RefreshCapable, TagCapable
{
const HTTP_METHOD_BAN = 'BAN';
public const HTTP_METHOD_BAN = 'BAN';

const HTTP_METHOD_PURGE = 'PURGE';
public const HTTP_METHOD_PURGE = 'PURGE';

const HTTP_METHOD_PURGEKEYS = 'PURGEKEYS';
public const HTTP_METHOD_PURGEKEYS = 'PURGEKEYS';

const HTTP_METHOD_REFRESH = 'GET';
public const HTTP_METHOD_REFRESH = 'GET';

const HTTP_HEADER_HOST = 'X-Host';
public const HTTP_HEADER_HOST = 'X-Host';

const HTTP_HEADER_URL = 'X-Url';
public const HTTP_HEADER_URL = 'X-Url';

const HTTP_HEADER_CONTENT_TYPE = 'X-Content-Type';
public const HTTP_HEADER_CONTENT_TYPE = 'X-Content-Type';

const TAG_BAN = 'ban';
public const TAG_BAN = 'ban';

const TAG_XKEY = 'purgekeys';
public const TAG_XKEY = 'purgekeys';

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

const DEFAULT_HTTP_HEADER_CACHE_XKEY = 'xkey-softpurge';
public const DEFAULT_HTTP_HEADER_CACHE_XKEY = 'xkey-softpurge';

/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion src/SymfonyCache/CustomTtlListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CustomTtlListener implements EventSubscriberInterface
*
* @var string
*/
const SMAXAGE_BACKUP = 'FOS-Smaxage-Backup';
public const SMAXAGE_BACKUP = 'FOS-Smaxage-Backup';

/**
* @param string $ttlHeader The header that is used to specify the TTL header
Expand Down
8 changes: 4 additions & 4 deletions src/SymfonyCache/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
*/
final class Events
{
const PRE_HANDLE = 'fos_http_cache.pre_handle';
public const PRE_HANDLE = 'fos_http_cache.pre_handle';

const POST_HANDLE = 'fos_http_cache.post_handle';
public const POST_HANDLE = 'fos_http_cache.post_handle';

const PRE_INVALIDATE = 'fos_http_cache.pre_invalidate';
public const PRE_INVALIDATE = 'fos_http_cache.pre_invalidate';

const PRE_STORE = 'fos_http_cache.pre_store';
public const PRE_STORE = 'fos_http_cache.pre_store';
}
4 changes: 2 additions & 2 deletions src/SymfonyCache/PurgeListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
*/
class PurgeListener extends AccessControlledListener
{
const DEFAULT_PURGE_METHOD = 'PURGE';
public const DEFAULT_PURGE_METHOD = 'PURGE';

const DEFAULT_CLEAR_CACHE_HEADER = 'Clear-Cache';
public const DEFAULT_CLEAR_CACHE_HEADER = 'Clear-Cache';

/**
* The purge method to use.
Expand Down
4 changes: 2 additions & 2 deletions src/SymfonyCache/PurgeTagsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
*/
class PurgeTagsListener extends AccessControlledListener
{
const DEFAULT_TAGS_METHOD = 'PURGETAGS';
public const DEFAULT_TAGS_METHOD = 'PURGETAGS';

const DEFAULT_TAGS_HEADER = 'X-Cache-Tags';
public const DEFAULT_TAGS_HEADER = 'X-Cache-Tags';

/**
* The purge tags method to use.
Expand Down
2 changes: 1 addition & 1 deletion src/TagHeaderFormatter/TagHeaderFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface TagHeaderFormatter
*
* @var string
*/
const DEFAULT_HEADER_NAME = 'X-Cache-Tags';
public const DEFAULT_HEADER_NAME = 'X-Cache-Tags';

/**
* Get the HTTP header name that will hold cache tags.
Expand Down

0 comments on commit 944b859

Please sign in to comment.