Skip to content

Commit

Permalink
minor #5608 DX: new cache filename (keradus)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.0 branch.

Discussion
----------

DX: new cache filename

Commits
-------

4c46c89 DX: new cache filename
  • Loading branch information
keradus committed Apr 12, 2021
2 parents 3cc811d + 4c46c89 commit 0c049a6
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
7 changes: 7 additions & 0 deletions UPGRADE-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ UPGRADE GUIDE FROM 2.x to 3.0

This is guide for upgrade from version 2.x to 3.0 for using the CLI tool.

Rename of files
---------------

| 2.x | 3.0 | Description |
| ---------------- | ------------------------ | -------------------------------------- |
| `.php_cs.cache` | `.php-cs-fixer.cache` | Cache file |

CLI options
-----------

Expand Down
2 changes: 1 addition & 1 deletion doc/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Cache file can be specified via ``--cache-file`` option or config file:
<?php
$config = new PhpCsFixer\Config();
return $config->setCacheFile(__DIR__.'/.php_cs.cache');
return $config->setCacheFile(__DIR__.'/.php-cs-fixer.cache');
Using PHP CS Fixer on CI
------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class Config implements ConfigInterface
{
private $cacheFile = '.php_cs.cache';
private $cacheFile = '.php-cs-fixer.cache';
private $customFixers = [];
private $finder;
private $format = 'txt';
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/HelpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public static function getHelpCopy(): string
$config = new Config();
return $config->setCacheFile(__DIR__.'/.php_cs.cache');
return $config->setCacheFile(__DIR__.'/.php-cs-fixer.cache');
?>
Expand Down
4 changes: 2 additions & 2 deletions tests/Cache/FileHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function testReadReturnsCache(): void

public function testWriteThrowsIOExceptionIfFileCanNotBeWritten(): void
{
$file = __DIR__.'/non-existent-directory/.php_cs.cache';
$file = __DIR__.'/non-existent-directory/.php-cs-fixer.cache';

$this->expectException(\Symfony\Component\Filesystem\Exception\IOException::class);
$this->expectExceptionMessageMatches(sprintf(
Expand Down Expand Up @@ -183,7 +183,7 @@ public function testWriteCacheFilePermissions(): void

private function getFile(): string
{
return __DIR__.'/.php_cs.cache';
return __DIR__.'/.php-cs-fixer.cache';
}

private function createSignature(): SignatureInterface
Expand Down
4 changes: 2 additions & 2 deletions tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public function testThatCacheFileHasDefaultValue(): void
{
$config = new Config();

static::assertSame('.php_cs.cache', $config->getCacheFile());
static::assertSame('.php-cs-fixer.cache', $config->getCacheFile());
}

public function testThatCacheFileCanBeMutated(): void
Expand Down Expand Up @@ -206,7 +206,7 @@ public function testConfigDefault(): void
{
$config = new Config();

static::assertSame('.php_cs.cache', $config->getCacheFile());
static::assertSame('.php-cs-fixer.cache', $config->getCacheFile());
static::assertSame([], $config->getCustomFixers());
static::assertSame('txt', $config->getFormat());
static::assertFalse($config->getHideProgress());
Expand Down
4 changes: 2 additions & 2 deletions tests/Console/ConfigurationResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1135,8 +1135,8 @@ public function provideGetDirectoryCases()
{
return [
[null, '/my/path/my/file', 'path/my/file'],
['/my/path2/dir/.php_cs.cache', '/my/path2/dir/dir2/file', 'dir2/file'],
['dir/.php_cs.cache', '/my/path/dir/dir3/file', 'dir3/file'],
['/my/path2/dir/.php-cs-fixer.cache', '/my/path2/dir/dir2/file', 'dir2/file'],
['dir/.php-cs-fixer.cache', '/my/path/dir/dir3/file', 'dir3/file'],
];
}

Expand Down

0 comments on commit 0c049a6

Please sign in to comment.