-
Notifications
You must be signed in to change notification settings - Fork 11
Upgrade everything to its newest version, use PSR-12, support PHP 8.3 #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,58 @@ | ||
# 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 | ||
Examples of configurations can be seen [here](https://tomasvotruba.com/blog/new-in-ecs-simpler-config) | ||
|
||
### 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 hidden or 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 hidden or 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(); | ||
D0L1K marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.