Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9712fe7

Browse files
committed
[make:*] upgrade bundled php-cs-fixer to version 3.49.0
1 parent c5be30d commit 9712fe7

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/Util/TemplateLinter.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
*/
2626
final class TemplateLinter
2727
{
28+
// Version must match bundled version file name. e.g. php-cs-fixer-v3.49.9.phar
29+
public const BUNDLED_PHP_CS_FIXER_VERSION = '3.49.0';
30+
2831
private bool $usingBundledPhpCsFixer = true;
2932
private bool $usingBundledPhpCsFixerConfig = true;
3033
private bool $needsPhpCmdPrefix = true;
@@ -96,7 +99,7 @@ private function setBinary(): void
9699
{
97100
// Use Bundled PHP-CS-Fixer
98101
if (null === $this->phpCsFixerBinaryPath) {
99-
$this->phpCsFixerBinaryPath = \dirname(__DIR__).'/Resources/bin/php-cs-fixer-v3.13.0.phar';
102+
$this->phpCsFixerBinaryPath = sprintf('%s/Resources/bin/php-cs-fixer-v%s.phar', \dirname(__DIR__), self::BUNDLED_PHP_CS_FIXER_VERSION);
100103

101104
return;
102105
}

tests/Util/TemplateLinterTest.php

+12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bundle\MakerBundle\Util\TemplateLinter;
16+
use Symfony\Component\Process\Process;
1617

1718
/**
1819
* Linter tests are written in `tests/Maker/TemplateLinterTest`.
@@ -36,4 +37,15 @@ public function testExceptionThrownIfConfigPathDoesntExist(): void
3637

3738
new TemplateLinter(phpCsFixerConfigPath: '/bad/config/path');
3839
}
40+
41+
public function testPhpCsFixerVersion(): void
42+
{
43+
$fixerPath = sprintf('%s/src/Resources/bin/php-cs-fixer-v%s.phar', dirname(__DIR__, 2), TemplateLinter::BUNDLED_PHP_CS_FIXER_VERSION);
44+
45+
$process = Process::fromShellCommandline(sprintf('PHP_CS_FIXER_IGNORE_ENV=1 %s -V', $fixerPath));
46+
47+
$process->run();
48+
49+
self::assertStringContainsString(TemplateLinter::BUNDLED_PHP_CS_FIXER_VERSION, $process->getOutput());
50+
}
3951
}

0 commit comments

Comments
 (0)