Skip to content

Commit

Permalink
[make:*] upgrade bundled php-cs-fixer to version 3.49.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jrushlow committed Feb 7, 2024
1 parent c5be30d commit 9712fe7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Binary file not shown.
5 changes: 4 additions & 1 deletion src/Util/TemplateLinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
*/
final class TemplateLinter
{
// Version must match bundled version file name. e.g. php-cs-fixer-v3.49.9.phar
public const BUNDLED_PHP_CS_FIXER_VERSION = '3.49.0';

private bool $usingBundledPhpCsFixer = true;
private bool $usingBundledPhpCsFixerConfig = true;
private bool $needsPhpCmdPrefix = true;
Expand Down Expand Up @@ -96,7 +99,7 @@ private function setBinary(): void
{
// Use Bundled PHP-CS-Fixer
if (null === $this->phpCsFixerBinaryPath) {
$this->phpCsFixerBinaryPath = \dirname(__DIR__).'/Resources/bin/php-cs-fixer-v3.13.0.phar';
$this->phpCsFixerBinaryPath = sprintf('%s/Resources/bin/php-cs-fixer-v%s.phar', \dirname(__DIR__), self::BUNDLED_PHP_CS_FIXER_VERSION);

return;
}
Expand Down
12 changes: 12 additions & 0 deletions tests/Util/TemplateLinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use PHPUnit\Framework\TestCase;
use Symfony\Bundle\MakerBundle\Util\TemplateLinter;
use Symfony\Component\Process\Process;

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

new TemplateLinter(phpCsFixerConfigPath: '/bad/config/path');
}

public function testPhpCsFixerVersion(): void
{
$fixerPath = sprintf('%s/src/Resources/bin/php-cs-fixer-v%s.phar', dirname(__DIR__, 2), TemplateLinter::BUNDLED_PHP_CS_FIXER_VERSION);

$process = Process::fromShellCommandline(sprintf('PHP_CS_FIXER_IGNORE_ENV=1 %s -V', $fixerPath));

$process->run();

self::assertStringContainsString(TemplateLinter::BUNDLED_PHP_CS_FIXER_VERSION, $process->getOutput());
}
}

0 comments on commit 9712fe7

Please sign in to comment.