diff --git a/README.md b/README.md index 5363a90..335da70 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Alma Career Coding Standard for PHP -[![Latest Stable Version](https://img.shields.io/packagist/v/lmc/coding-standard.svg?style=flat-square)](https://packagist.org/packages/lmc/coding-standard) +[![Latest Stable Version](https://img.shields.io/packagist/v/almacareer/coding-standard.svg?style=flat-square)](https://packagist.org/packages/almacareer/coding-standard) PHP coding standard used in [Alma Career][Alma Career] (formerly LMC) products. @@ -9,10 +9,36 @@ various checks to make sure the code is readable, follows the same conventions, We use [EasyCodingStandard][ecs] to define and execute checks created for both [PHP-CS-Fixer] and [PHP_CodeSniffer]. +## Switching from lmc/coding-standard + +The package `almacareer/coding-standard` is 1:1 replacement for the previous deprecated `lmc/coding-standard` package. +To change the package, you only need to do the following changes in your project: + +### 1. Update dependency in composer.json +```diff +- "lmc/coding-standard": "^4.1", ++ "almacareer/coding-standard": "^4.1", +``` + +and then run `composer update`. + +### 2. Change path to ecs.php in your ecs.php + +You can also use `SetList:ALMACAREER` instead of explicitly specifying path to the file: + +```diff + ->withSets( + [ +- __DIR__ . '/vendor/lmc-eu/coding-standard/ecs.php', ++ \Lmc\CodingStandard\Set\SetList::ALMACAREER, + ] + ); +``` + ## Installation ```bash -composer require --dev lmc/coding-standard +composer require --dev almacareer/coding-standard ``` ## Usage diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index f97034f..aa0d0b2 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -1,11 +1,12 @@ # Upgrading from 3.x to 4.0 ### 1. Update dependency in composer.json -In the `require-dev` section of `composer.json` change the version constraint: +In the `require-dev` section of `composer.json` change the version constraint. This also includes +renaming of the package to `almacareer/coding-standard`: ```diff - "lmc/coding-standard": "^3.3", -+ "lmc/coding-standard": "^4.0", ++ "almacareer/coding-standard": "^4.0", ``` Then run `composer update`. @@ -16,13 +17,14 @@ The configuration now uses `ECSConfig` class instead of `ContainerConfigurator`. Update your `ecs.php` file to use the new configuration style: ```diff ++use Lmc\CodingStandard\Set\SetList; -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; +use Symplify\EasyCodingStandard\Config\ECSConfig; -return static function (ContainerConfigurator $containerConfigurator): void { +return ECSConfig::configure() + ->withSets([ -+ __DIR__ . '/vendor/lmc/coding-standard/ecs.php', ++ SetList::ALMACAREER, + ]); // ... ``` diff --git a/composer.json b/composer.json index d3785bf..0abd1e4 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "lmc/coding-standard", + "name": "almacareer/coding-standard", "description": "Coding standard used in Alma Career projects", "license": "MIT", "type": "library",