Skip to content

Commit b9f2c32

Browse files
authored
Merge pull request #6 from jakubtobiasz/main
Allow repositories to be marked as final
2 parents a5d2531 + 8fac2f2 commit b9f2c32

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

ecs.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
use BitBag\CodingStandard\Fixer\FinalClassInEntitiesOrRepositoriesFixer;
5+
use BitBag\CodingStandard\Fixer\FinalClassInEntitiesFixer;
66
use BitBag\CodingStandard\Fixer\AboveTwoArgumentsMultilineFixer;
77
use PhpCsFixer\Fixer\Alias\EregToPregFixer;
88
use PhpCsFixer\Fixer\Alias\NoAliasFunctionsFixer;
@@ -391,9 +391,8 @@
391391
$services->set(RequireOneLinePropertyDocCommentSniff::class);
392392

393393
$services->set(YodaStyleFixer::class)->call('configure',[['equal' => true, 'identical' => true, 'less_and_greater' => true,]]);
394-
395-
$services->set(FinalClassInEntitiesOrRepositoriesFixer::class);
396-
394+
395+
$services->set(FinalClassInEntitiesFixer::class);
396+
397397
$services->set(AboveTwoArgumentsMultilineFixer::class);
398398
};
399-

src/Fixer/FinalClassInEntitiesOrRepositoriesFixer.php renamed to src/Fixer/FinalClassInEntitiesFixer.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use PhpCsFixer\Tokenizer\Tokens;
1212
use SplFileInfo;
1313

14-
final class FinalClassInEntitiesOrRepositoriesFixer implements FixerInterface
14+
final class FinalClassInEntitiesFixer implements FixerInterface
1515
{
1616
public function isCandidate(Tokens $tokens): bool
1717
{
@@ -42,7 +42,7 @@ public function fix(SplFileInfo $file, Tokens $tokens): void
4242
public function getDefinition(): FixerDefinitionInterface
4343
{
4444
return new FixerDefinition(
45-
'Repositories and Entities should not be defined as final.',
45+
'Entities should not be defined as final.',
4646
[
4747
new CodeSample(
4848
'<?php
@@ -69,6 +69,6 @@ public function getPriority(): int
6969

7070
public function supports(SplFileInfo $file): bool
7171
{
72-
return str_contains($file->getPath(), 'src/Entity') || str_contains($file->getPath(), 'src/Repository');
72+
return strpos($file->getPath(), 'src/Entity') !== false;
7373
}
7474
}

0 commit comments

Comments
 (0)