Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing final #164

Merged
merged 2 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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