Skip to content

Commit 16983be

Browse files
authored
Replace PHP_CodeSniffer with EasyCodingStandard (#80)
* Replace PHP_CodeSniffer with EasyCodingStandard * Apply CodeStyle from ECS * Add ECS comments set * Add ECS namespaces set * Add ECS dockblock set * Add ECS array set * Fixed multiple blank lines between methods
1 parent 28337de commit 16983be

File tree

137 files changed

+124
-452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+124
-452
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ jobs:
5757
with:
5858
php-version: '8.2'
5959
symfony-version: '6.2.*'
60-
- name: "Run checkstyle with squizlabs/php_codesniffer"
61-
run: vendor/bin/phpcs
60+
- name: "Run checkstyle with symplify/easy-coding-standard"
61+
run: vendor/bin/ecs
6262

6363
conventions:
6464
name: "Conventions"

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/.idea/
2-
/.phpcs-cache
32
/.phpunit.result.cache
43
/tests/.artifacts/
54
/tests/symfony/var/

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
"phpspec/prophecy-phpunit": "^2.0",
3838
"phpstan/phpstan": "^1.4",
3939
"phpunit/phpunit": "^9.5",
40-
"squizlabs/php_codesniffer": "^3.6",
4140
"symfony/filesystem": "^5.0|^6.0",
4241
"symfony/finder": "^5.0|^6.0",
43-
"symfony/process": "^5.0|^6.0"
42+
"symfony/process": "^5.0|^6.0",
43+
"symplify/easy-coding-standard": "^11.3"
4444
},
4545
"replace": {
4646
"yokai/batch": "self.version",

ecs.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff;
6+
use PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer;
7+
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer;
8+
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer;
9+
use Symplify\CodingStandard\Fixer\ArrayNotation\StandaloneLineInMultilineArrayFixer;
10+
use Symplify\EasyCodingStandard\Config\ECSConfig;
11+
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
12+
13+
return function (ECSConfig $ecsConfig): void {
14+
$ecsConfig->paths([
15+
__DIR__ . '/src',
16+
__DIR__ . '/tests/convention',
17+
__DIR__ . '/tests/integration',
18+
__DIR__ . '/tests/symfony/src',
19+
__DIR__ . '/tests/symfony/tests',
20+
]);
21+
22+
$ecsConfig->sets([
23+
SetList::ARRAY,
24+
SetList::DOCBLOCK,
25+
SetList::NAMESPACES,
26+
SetList::COMMENTS,
27+
SetList::STRICT,
28+
SetList::PSR_12,
29+
]);
30+
31+
$ecsConfig->skip([
32+
/* Do not force array on multiple lines : ['foo' => $foo, 'bar' => $bar] */
33+
ArrayOpenerAndCloserNewlineFixer::class,
34+
ArrayListItemNewlineFixer::class,
35+
StandaloneLineInMultilineArrayFixer::class,
36+
]);
37+
38+
$ecsConfig->ruleWithConfiguration(ForbiddenFunctionsSniff::class, [
39+
'forbiddenFunctions' => ['dump' => null, 'dd' => null, 'var_dump' => null, 'die' => null],
40+
]);
41+
$ecsConfig->ruleWithConfiguration(FunctionDeclarationFixer::class, [
42+
'closure_fn_spacing' => 'none',
43+
]);
44+
};

phpcs.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

scripts/tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ install () {
1616
}
1717

1818
install "php82" "6.2.*"
19-
led in -s php82 -- vendor/bin/phpcs
19+
led in -s php82 -- vendor/bin/ecs
2020
led in -s php82 -- vendor/bin/phpstan analyze
2121
led in -s php82 -- vendor/bin/phpunit --testsuite=Convention
2222

src/batch-box-spout/src/Reader/FlatFileReader.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ public function __construct(
3636
$this->headerStrategy = $headerStrategy ?? HeaderStrategy::skip();
3737
}
3838

39-
/**
40-
* @inheritDoc
41-
*/
4239
public function read(): iterable
4340
{
4441
/** @var string $path */

src/batch-box-spout/src/Reader/Options/CSVOptions.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ public function __construct(
2222
) {
2323
}
2424

25-
/**
26-
* @inheritdoc
27-
*/
2825
public function configure(ReaderInterface $reader): void
2926
{
3027
if (!$reader instanceof CSVReader) {
@@ -38,9 +35,6 @@ public function configure(ReaderInterface $reader): void
3835
$reader->setShouldPreserveEmptyRows($this->preserveEmptyRows);
3936
}
4037

41-
/**
42-
* @inheritdoc
43-
*/
4438
public function getSheets(ReaderInterface $reader): iterable
4539
{
4640
return $reader->getSheetIterator();

src/batch-box-spout/src/Reader/Options/ODSOptions.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ public function __construct(
2323
$this->sheetFilter = $sheetFilter ?? SheetFilter::all();
2424
}
2525

26-
/**
27-
* @inheritDoc
28-
*/
2926
public function configure(ReaderInterface $reader): void
3027
{
3128
if (!$reader instanceof ODSReader) {
@@ -36,9 +33,6 @@ public function configure(ReaderInterface $reader): void
3633
$reader->setShouldPreserveEmptyRows($this->preserveEmptyRows);
3734
}
3835

39-
/**
40-
* @inheritDoc
41-
*/
4236
public function getSheets(ReaderInterface $reader): iterable
4337
{
4438
yield from $this->sheetFilter->getSheets($reader);

src/batch-box-spout/src/Reader/Options/XLSXOptions.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ public function __construct(
2323
$this->sheetFilter = $sheetFilter ?? SheetFilter::all();
2424
}
2525

26-
/**
27-
* @inheritDoc
28-
*/
2926
public function configure(ReaderInterface $reader): void
3027
{
3128
if (!$reader instanceof XLSXReader) {
@@ -36,9 +33,6 @@ public function configure(ReaderInterface $reader): void
3633
$reader->setShouldPreserveEmptyRows($this->preserveEmptyRows);
3734
}
3835

39-
/**
40-
* @inheritDoc
41-
*/
4236
public function getSheets(ReaderInterface $reader): iterable
4337
{
4438
yield from $this->sheetFilter->getSheets($reader);

0 commit comments

Comments
 (0)