Skip to content

Commit 8bb84ef

Browse files
authored
Make sure fixers from the repo are used to check own code (#952)
1 parent 425ea44 commit 8bb84ef

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.dev-tools/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
},
1919
"autoload": {
2020
"psr-4": {
21+
"PhpCsFixerCustomFixers\\": "../src",
2122
"PhpCsFixer\\": "../vendor/friendsofphp/php-cs-fixer/src"
2223
}
2324
},

.php-cs-fixer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@
1212
require_once __DIR__ . '/.dev-tools/vendor/autoload.php';
1313
require_once __DIR__ . '/vendor/autoload.php';
1414

15+
// sanity check
16+
$expectedPath = realpath(__DIR__ . '/src/Fixers.php');
17+
$actualPath = (new ReflectionClass(PhpCsFixerCustomFixers\Fixers::class))->getFileName();
18+
if ($expectedPath !== $actualPath) {
19+
printf(
20+
'Class %s must be loaded from "%s", but loaded from "%s"!' . PHP_EOL,
21+
PhpCsFixerCustomFixers\Fixers::class,
22+
$expectedPath,
23+
$actualPath,
24+
);
25+
exit(1);
26+
}
27+
1528
$rules = (new PhpCsFixerConfig\Rules\LibraryRules('PHP CS Fixer: custom fixers', 'Kuba Werłos', 2018))->getRules();
1629

1730
$rules[PhpCsFixerCustomFixers\Fixer\NoSuperfluousConcatenationFixer::name()] = ['allow_preventing_trailing_spaces' => true];

0 commit comments

Comments
 (0)