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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* jindrich.pech@almamedia.com
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
- Temporarily disable `ArrayDeclarationSniff.ValueNoNewline` because of [bug](https://github.com/squizlabs/PHP_CodeSniffer/issues/2937) in PHP_CodeSniffer 3.5.5.

## 2.0.0 - 2020-03-02
- BC: change the way the standard is imported to your `easy-coding-standard.yaml` (change `%vendor_dir%` placeholder directly to name of the vendor directory like `vendor`). See example in [README](https://github.com/lmc-eu/php-coding-standard#usage).
- BC: change the way the standard is imported to your `easy-coding-standard.yaml` (change `%vendor_dir%` placeholder directly to name of the vendor directory like `vendor`). See example in [README](https://github.com/alma-oss/php-coding-standard#usage).
- Drop PHP 7.1 support.
- Require EasyCodingStandard 7+.
- `VisibilityRequiredFixer` now check visibility is declared also on class constants.
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Alma Career Czechia Coding Standard for PHP
# 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)

PHP coding standard used in [Alma Career Czechia][Alma Career] (formerly LMC) products.
PHP coding standard used in [Alma Career][Alma Career] (formerly LMC) products.

The standard is based on [PSR-12][psr-12] and partially [PER 2.0][per-2] and adds
various checks to make sure the code is readable, follows the same conventions, and does not contain common mistakes.
Expand All @@ -22,14 +22,15 @@ composer require --dev lmc/coding-standard
```php
<?php declare(strict_types=1);

use Lmc\CodingStandard\Set\SetList;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
->withPaths([__DIR__ . '/src', __DIR__ . '/tests']) // optionally add 'config' or other directories with PHP files
->withRootFiles() // to also check ecs.php and all other php files in the root directory
->withSets(
[
__DIR__ . '/vendor/lmc/coding-standard/ecs.php',
SetList::ALMACAREER,
]
);
```
Expand Down Expand Up @@ -67,6 +68,7 @@ Below find examples of some more opinionated checks you may want to add dependin
```php
<?php declare(strict_types=1);

use Lmc\CodingStandard\Set\SetList;
use PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
Expand All @@ -75,7 +77,7 @@ return ECSConfig::configure()
/* (...) */
->withSets(
[
__DIR__ . '/vendor/lmc/coding-standard/ecs.php',
SetList::ALMACAREER,
]
)
->withRules(
Expand Down
4 changes: 2 additions & 2 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Now change the way you set rules, skip tests and import sets:
| `$parameters->set(Option::SKIP, ...)` | `ECSConfig::configure()->withSkip()` |
| `$containerConfigurator->import()` | `ECSConfig::configure()->withSets()` |

See [examples in Usage section of our README](https://github.com/lmc-eu/php-coding-standard?tab=readme-ov-file#usage)
See [examples in Usage section of our README](https://github.com/alma-oss/php-coding-standard?tab=readme-ov-file#usage)
or more configuration options in [ECS documentation](https://github.com/easy-coding-standard/easy-coding-standard/tree/main?tab=readme-ov-file#configure).

Some more reasoning and examples of configurations can also be seen [in ECS author blogpost](https://tomasvotruba.com/blog/new-in-ecs-simpler-config).
Expand Down Expand Up @@ -88,7 +88,7 @@ $ vendor/bin/ecs check --ansi # new
### 6. Add some optional rules
On top of default rules included in ecs.php, there are some more opinionated ones you may want to add.

These suggested rules are listed in [README.md](https://github.com/lmc-eu/php-coding-standard?tab=readme-ov-file#add-custom-checks-or-override-default-settings).
These suggested rules are listed in [README.md](https://github.com/alma-oss/php-coding-standard?tab=readme-ov-file#add-custom-checks-or-override-default-settings).

### 5. BE CAREFUL WITH SUGGESTED CHANGES! ⚠️

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "lmc/coding-standard",
"description": "Coding standard used in Alma Career Czechia (LMC) projects",
"description": "Coding standard used in Alma Career projects",
"license": "MIT",
"type": "library",
"authors": [
{
"name": "Alma Career",
"homepage": "https://github.com/almacareer/"
"homepage": "https://github.com/alma-oss/"
}
],
"require": {
Expand Down
3 changes: 2 additions & 1 deletion ecs-internal.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php declare(strict_types=1);

use Lmc\CodingStandard\Set\SetList;
use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff;
use PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer;
Expand All @@ -14,7 +15,7 @@
->withRootFiles()
->withSets(
[
__DIR__ . '/ecs.php',
SetList::ALMACAREER,
],
)
->withConfiguredRule(PhpUnitTestAnnotationFixer::class, ['style' => 'annotation'])
Expand Down
11 changes: 11 additions & 0 deletions src/Set/SetList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php declare(strict_types=1);

namespace Lmc\CodingStandard\Set;

class SetList
{
/**
* @var string
*/
public const ALMACAREER = __DIR__ . '/../../ecs.php';
}
Loading