Skip to content

Commit 4f7c0d8

Browse files
committed
Release version 5.0.0
1 parent cb1615d commit 4f7c0d8

File tree

3 files changed

+107
-2
lines changed

3 files changed

+107
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
<!-- There is always Unreleased section on the top. Subsections (Added, Changed, Fixed, Removed) should be added as needed. -->
66

77
## Unreleased
8-
- Remove skip of BlankLineAfterOpeningTagFixer to be PSR-12 compliant.
8+
9+
## 5.0.0 - TBD
10+
- **BC break:** Change namespace from `Lmc\CodingStandard` to `AlmaOss\CodingStandard`. See [UPGRADE-5.0.md](UPGRADE-5.0.md) for step-by-step upgrade howto.
11+
- **BC break:** Remove skip of `BlankLineAfterOpeningTagFixer` to be PSR-12 compliant. A blank line after the opening PHP tag is now required.
912

1013
## 4.2.0 - 2025-02-28
1114
- Rename the package from "Alma Career Czechia Standard for PHP" to more broad "Alma Career Coding Standard for PHP". 🎉

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ We use [EasyCodingStandard][ecs] to define and execute checks created for both [
1212
## Switching from lmc/coding-standard
1313

1414
The package `almacareer/coding-standard` is 1:1 replacement for the previous deprecated `lmc/coding-standard` package.
15+
16+
⚠️ **Note:** Starting from version 5.0.0, the namespace has changed from `Lmc\CodingStandard` to `AlmaOss\CodingStandard`. See [UPGRADE-5.0.md](UPGRADE-5.0.md) for detailed upgrade instructions.
17+
1518
To change the package, you only need to do the following changes in your project:
1619

1720
### 1. Update dependency in composer.json
1821
```diff
1922
- "lmc/coding-standard": "^4.1",
20-
+ "almacareer/coding-standard": "^4.2",
23+
+ "almacareer/coding-standard": "^5.0",
2124
```
2225

2326
And then run `composer update`.

UPGRADE-5.0.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Upgrading from 4.x to 5.0
2+
3+
### 1. Update dependency in composer.json
4+
In the `require-dev` section of `composer.json` change the version constraint:
5+
6+
```diff
7+
- "almacareer/coding-standard": "^4.2",
8+
+ "almacareer/coding-standard": "^5.0",
9+
```
10+
11+
Then run `composer update almacareer/coding-standard`.
12+
13+
### 2. Update namespace imports
14+
15+
**[BC break]** The namespace has been changed from `Lmc\CodingStandard` to `AlmaOss\CodingStandard`.
16+
17+
Update your `ecs.php` file to use the new namespace:
18+
19+
```diff
20+
<?php
21+
22+
declare(strict_types=1);
23+
24+
-use Lmc\CodingStandard\Set\SetList;
25+
+use AlmaOss\CodingStandard\Set\SetList;
26+
use Symplify\EasyCodingStandard\Config\ECSConfig;
27+
28+
return ECSConfig::configure()
29+
->withSets(
30+
[
31+
SetList::ALMACAREER,
32+
]
33+
);
34+
```
35+
36+
If you are using any custom sniffs or fixers from this package in your configuration, update their namespace as well:
37+
38+
```diff
39+
-use Lmc\CodingStandard\Fixer\SpecifyArgSeparatorFixer;
40+
+use AlmaOss\CodingStandard\Fixer\SpecifyArgSeparatorFixer;
41+
42+
-use Lmc\CodingStandard\Sniffs\Naming\ClassNameSuffixByParentSniff;
43+
+use AlmaOss\CodingStandard\Sniffs\Naming\ClassNameSuffixByParentSniff;
44+
```
45+
46+
### 3. PSR-12 compliance change
47+
48+
**[BC break]** The `BlankLineAfterOpeningTagFixer` is no longer skipped. This means that a blank line after the opening PHP tag (`<?php`) is now required to be PSR-12 compliant.
49+
50+
Before (no longer valid):
51+
```php
52+
<?php
53+
declare(strict_types=1);
54+
```
55+
56+
After (PSR-12 compliant):
57+
```php
58+
<?php
59+
60+
declare(strict_types=1);
61+
```
62+
63+
If your codebase does not follow this convention yet, running `vendor/bin/ecs check --fix` will automatically add the blank lines.
64+
65+
If you want to keep the old behavior and skip this check, you can add it to your `ecs.php`:
66+
67+
```php
68+
use PhpCsFixer\Fixer\Whitespace\BlankLineAfterOpeningTagFixer;
69+
70+
return ECSConfig::configure()
71+
// ...
72+
->withSkip([
73+
BlankLineAfterOpeningTagFixer::class,
74+
]);
75+
```
76+
77+
### 4. Run the code style checks
78+
79+
After updating the namespace, run the code style checks to ensure everything is working correctly:
80+
81+
```bash
82+
vendor/bin/ecs check
83+
```
84+
85+
To automatically fix the code style issues (including the blank line after opening tag):
86+
87+
```bash
88+
vendor/bin/ecs check --fix
89+
```
90+
91+
### 5. Sanity check
92+
93+
You can ensure all predefined checks are loaded by running:
94+
95+
```sh
96+
vendor/bin/ecs list-checkers
97+
```
98+
99+
The output should show all the loaded checkers from both PHP-CS-Fixer and PHP_CodeSniffer.

0 commit comments

Comments
 (0)