Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
Expand Down
8 changes: 5 additions & 3 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand All @@ -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,
+ ]);
// ...
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "lmc/coding-standard",
"name": "almacareer/coding-standard",
"description": "Coding standard used in Alma Career projects",
"license": "MIT",
"type": "library",
Expand Down