mirror of
https://github.com/symfony/maker-bundle.git
synced 2026-03-23 23:42:10 +01:00
Upgrade bundled php-cs-fixer.phar to 3.92.5
This commit is contained in:
@@ -32,9 +32,48 @@ composer update
|
||||
composer update --working-dir=tools/phpstan
|
||||
composer update --working-dir=tools/phpstan/includes
|
||||
```
|
||||
|
||||
Run PHPStan with:
|
||||
|
||||
```bash
|
||||
tools/phpstan/vendor/bin/phpstan
|
||||
```
|
||||
|
||||
## Style Checking
|
||||
|
||||
This project uses [PHP CS Fixer](https://cs.symfony.com/) to ensure code style consistency.
|
||||
|
||||
Install the required dependencies with:
|
||||
|
||||
```bash
|
||||
composer update --working-dir=tools/php-cs-fixer
|
||||
```
|
||||
|
||||
To fix the code style, run:
|
||||
|
||||
```bash
|
||||
tools/php-cs-fixer/vendor/bin/php-cs-fixer fix
|
||||
```
|
||||
|
||||
## Bundled PHP CS Fixer
|
||||
|
||||
The PHP-CS-Fixer package is bundled with this project and used by some makers.
|
||||
|
||||
To update the Phar file to the latest version, run:
|
||||
|
||||
```bash
|
||||
curl -fsSLo src/Resources/bin/php-cs-fixer.phar https://cs.symfony.com/download/php-cs-fixer-v3.phar
|
||||
chmod a+x src/Resources/bin/php-cs-fixer.phar
|
||||
```
|
||||
|
||||
Get the version of the downloaded Phar file:
|
||||
|
||||
```bash
|
||||
php src/Resources/bin/php-cs-fixer.phar --version
|
||||
```
|
||||
|
||||
Update the `BUNDLED_PHP_CS_FIXER_VERSION` constant in `src/Util/TemplateLinter.php`:
|
||||
|
||||
```diff
|
||||
- public const BUNDLED_PHP_CS_FIXER_VERSION = '3.49.0';
|
||||
+ public const BUNDLED_PHP_CS_FIXER_VERSION = '3.92.5';
|
||||
```
|
||||
|
||||
Binary file not shown.
@@ -25,8 +25,7 @@ use Symfony\Component\Process\Process;
|
||||
*/
|
||||
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';
|
||||
public const BUNDLED_PHP_CS_FIXER_VERSION = '3.92.5';
|
||||
|
||||
private bool $usingBundledPhpCsFixer = true;
|
||||
private bool $usingBundledPhpCsFixerConfig = true;
|
||||
@@ -100,7 +99,7 @@ final class TemplateLinter
|
||||
{
|
||||
// Use Bundled PHP-CS-Fixer
|
||||
if (null === $this->phpCsFixerBinaryPath) {
|
||||
$this->phpCsFixerBinaryPath = \sprintf('%s/Resources/bin/php-cs-fixer-v%s.phar', \dirname(__DIR__), self::BUNDLED_PHP_CS_FIXER_VERSION);
|
||||
$this->phpCsFixerBinaryPath = \sprintf('%s/Resources/bin/php-cs-fixer.phar', \dirname(__DIR__));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class <?= $class_name ?> implements NormalizerInterface
|
||||
{
|
||||
public function __construct(
|
||||
#[Autowire(service: 'serializer.normalizer.object')]
|
||||
private NormalizerInterface $normalizer
|
||||
private NormalizerInterface $normalizer,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace <?= $class_data->getNamespace(); ?>;
|
||||
public function __construct(
|
||||
public string $mode = 'strict',
|
||||
?array $groups = null,
|
||||
mixed $payload = null
|
||||
mixed $payload = null,
|
||||
) {
|
||||
parent::__construct([], $groups, $payload);
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ final class TemplateLinterTest extends TestCase
|
||||
{
|
||||
$this->markTestSkippedOnWindows();
|
||||
|
||||
$fixerPath = \sprintf('%s/src/Resources/bin/php-cs-fixer-v%s.phar', \dirname(__DIR__, 2), TemplateLinter::BUNDLED_PHP_CS_FIXER_VERSION);
|
||||
$fixerPath = \sprintf('%s/src/Resources/bin/php-cs-fixer.phar', \dirname(__DIR__, 2));
|
||||
|
||||
$process = Process::fromShellCommandline(\sprintf('%s -V', $fixerPath));
|
||||
$process = Process::fromShellCommandline(\sprintf('PHP_CS_FIXER_IGNORE_ENV=1 %s -V', $fixerPath));
|
||||
|
||||
$process->run();
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class EntityFixtureNormalizer implements NormalizerInterface
|
||||
{
|
||||
public function __construct(
|
||||
#[Autowire(service: 'serializer.normalizer.object')]
|
||||
private NormalizerInterface $normalizer
|
||||
private NormalizerInterface $normalizer,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class FooBarNormalizer implements NormalizerInterface
|
||||
{
|
||||
public function __construct(
|
||||
#[Autowire(service: 'serializer.normalizer.object')]
|
||||
private NormalizerInterface $normalizer
|
||||
private NormalizerInterface $normalizer,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ final class FooBar extends Constraint
|
||||
public function __construct(
|
||||
public string $mode = 'strict',
|
||||
?array $groups = null,
|
||||
mixed $payload = null
|
||||
mixed $payload = null,
|
||||
) {
|
||||
parent::__construct([], $groups, $payload);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
{
|
||||
"require": {
|
||||
"friendsofphp/php-cs-fixer": "^3.75"
|
||||
"friendsofphp/php-cs-fixer": "^3.92"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user