Skip to content

Commit

Permalink
Add missing final (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored Jan 13, 2024
1 parent 2738135 commit 222d478
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .phpstan/ExceptionTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PHPStan\Rules\Exceptions\DefaultExceptionTypeResolver;
use PHPStan\Rules\Exceptions\ExceptionTypeResolver as PHPStanExceptionTypeResolver;

class ExceptionTypeResolver implements PHPStanExceptionTypeResolver
final class ExceptionTypeResolver implements PHPStanExceptionTypeResolver
{
public function __construct(private DefaultExceptionTypeResolver $defaultExceptionTypeResolver)
{
Expand Down
8 changes: 8 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector;
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
Expand All @@ -17,6 +20,11 @@
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
]);
$rectorConfig->rules([
FinalizeClassesWithoutChildrenRector::class,
PrivatizeFinalClassMethodRector::class,
PrivatizeFinalClassPropertyRector::class,
]);

$rectorConfig->importNames();
};
2 changes: 1 addition & 1 deletion src/Standard/Twig.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @see https://twig.symfony.com/doc/3.x/coding_standards.html
*/
class Twig implements StandardInterface
final class Twig implements StandardInterface
{
public function getRules(): array
{
Expand Down
2 changes: 1 addition & 1 deletion tests/File/FinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use PHPUnit\Framework\TestCase;
use TwigCsFixer\File\Finder;

class FinderTest extends TestCase
final class FinderTest extends TestCase
{
public function testFinder(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Report/ViolationIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use PHPUnit\Framework\TestCase;
use TwigCsFixer\Report\ViolationId;

class ViolationIdTest extends TestCase
final class ViolationIdTest extends TestCase
{
/**
* @dataProvider toStringDataProvider
Expand Down
13 changes: 13 additions & 0 deletions tests/Report/ViolationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ public function testGetters(): void
static::assertSame($violationId, $violation->getIdentifier());
}

public function testGetterWithoutViolationId(): void
{
$violation = new Violation(Violation::LEVEL_WARNING, 'message', 'filename', 'name');

static::assertSame(Violation::LEVEL_WARNING, $violation->getLevel());
static::assertSame('message', $violation->getMessage());
static::assertSame('filename', $violation->getFilename());
static::assertNull($violation->getLine());
static::assertNull($violation->getLinePosition());
static::assertSame('name', $violation->getRuleName());
static::assertNull($violation->getIdentifier());
}

/**
* @dataProvider getLevelAsStringDataProvider
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/Fixtures/FakeRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* This rule reports an error for the first token of every line.
*/
class FakeRule extends AbstractRule
final class FakeRule extends AbstractRule
{
public function process(int $tokenPosition, array $tokens): void
{
Expand Down

0 comments on commit 222d478

Please sign in to comment.