-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade everything to its newest version, use PSR-12
- Loading branch information
Martin Guth
committed
Apr 16, 2024
1 parent
aadd000
commit f8c1b3a
Showing
18 changed files
with
515 additions
and
595 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Upgrading from 3.x to 4.0 | ||
|
||
### 1. Update dependency in composer.json | ||
In require-dev section change the version constraint: | ||
|
||
```diff | ||
- "lmc/coding-standard": "^3.3", | ||
+ "lmc/coding-standard": "^4.0", | ||
``` | ||
|
||
Then run `composer update`. | ||
|
||
### 2. Configuration updates | ||
|
||
Configuration now uses ECSConfig class instead of ContainerConfigurator. Update your `ecs.php` to use the new configuration style: | ||
|
||
```diff | ||
-use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
- | ||
-return static function (ContainerConfigurator $containerConfigurator): void { | ||
+use Symplify\EasyCodingStandard\Config\ECSConfig; | ||
+ | ||
+return ECSConfig::configure() | ||
``` | ||
|
||
Rules are now set using `ECSConfig::configure()->withRules([])` or `ECSConfig::configure()->withConfiguredRule()` instead of `$services->set()`. | ||
Skiping tests is now done using `ECSConfig::configure()->withSkip()` instead of `$parameters->set(Option::SKIP, ...)`. | ||
Imports are now done using `ECSConfig::configure()->withSets()` instead of `$containerConfigurator->import()`. | ||
|
||
See [ECS documentation](https://github.com/easy-coding-standard/easy-coding-standard/tree/main?tab=readme-ov-file#configure) for more configuration options and examples. | ||
|
||
### 3. Remove imports of `ecs-7.4.php` and/or `ecs-8.0.php` from your `ecs.php` | ||
```diff | ||
->withSets(__DIR__ . '/vendor/lmc/coding-standard/ecs.php') | ||
- ->withSets(__DIR__ . '/vendor/lmc/coding-standard/ecs-7.4.php') | ||
- ->withSets(__DIR__ . '/vendor/lmc/coding-standard/ecs-8.0.php') | ||
->withSets(__DIR__ . '/vendor/lmc/coding-standard/ecs-8.1.php') | ||
``` | ||
|
||
### 4. Sanity check | ||
Besides running your code style checks, you can ensure all predefined LMC checks are loaded as well, by running: | ||
|
||
```sh | ||
vendor/bin/ecs list-checkers | ||
``` | ||
|
||
The result should end with something like: | ||
``` | ||
41 checkers from PHP_CodeSniffer: | ||
... | ||
147 checkers from PHP-CS-Fixer: | ||
... | ||
2 checkers are skipped: | ||
... | ||
``` | ||
|
||
(or some close number, depending on your custom code-style settings). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,5 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
use Symplify\EasyCodingStandard\Config\ECSConfig; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator): void { | ||
$containerConfigurator->import(__DIR__ . '/ecs-8.0.php'); | ||
|
||
// class with constants only -> enum | ||
// @see https://www.php.net/releases/8.1/en.php#enumerations | ||
|
||
// readonly properties | ||
// @see https://www.php.net/releases/8.1/en.php#readonly_properties | ||
|
||
// first-class callable | ||
// @see https://www.php.net/releases/8.1/en.php#first_class_callable_syntax | ||
}; | ||
return ECSConfig::configure(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Symplify\EasyCodingStandard\Config\ECSConfig; | ||
|
||
return ECSConfig::configure() | ||
->withSets([__DIR__ . '/ecs-8.1.php']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Symplify\EasyCodingStandard\Config\ECSConfig; | ||
|
||
return ECSConfig::configure() | ||
->withSets([__DIR__ . '/ecs-8.2.php']); |
Oops, something went wrong.