Skip to content

Commit 9dbc5bf

Browse files
committed
Adapt auto-loading to phpcs style and reintroduce TestCase, so we can test custom sniffs when added
1 parent 7ffa96e commit 9dbc5bf

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
"license": "MIT",
66
"autoload": {
77
"psr-4": {
8-
"Cdn77\\Sniffs\\": "src/Cdn77/Sniffs"
8+
"Cdn77\\": "src/Cdn77"
99
}
1010
},
1111
"autoload-dev": {
1212
"psr-4": {
13-
"Cdn77\\Sniffs\\Tests\\": "tests/Sniffs"
13+
"Cdn77\\": "tests"
1414
}
1515
},
1616
"require": {

tests/TestCase.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Cdn77;
6+
7+
use SlevomatCodingStandard\Sniffs\TestCase as SlevomatTestCase;
8+
9+
use function str_replace;
10+
use function strlen;
11+
use function substr;
12+
13+
abstract class TestCase extends SlevomatTestCase
14+
{
15+
protected static function getSniffClassName(): string
16+
{
17+
return str_replace('\\Tests\\', '\\', substr(static::class, 0, -strlen('Test')));
18+
}
19+
}

0 commit comments

Comments
 (0)