Skip to content

cleanup: use final classes #1409

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

Merged
merged 1 commit into from
Mar 22, 2023
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 src/Command/AddUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
name: 'app:add-user',
description: 'Creates users and stores them in the database'
)]
class AddUserCommand extends Command
final class AddUserCommand extends Command
{
private SymfonyStyle $io;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/DeleteUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
name: 'app:delete-user',
description: 'Deletes users from the database'
)]
class DeleteUserCommand extends Command
final class DeleteUserCommand extends Command
{
private SymfonyStyle $io;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/ListUsersCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
description: 'Lists all the existing users',
aliases: ['app:users']
)]
class ListUsersCommand extends Command
final class ListUsersCommand extends Command
{
public function __construct(
private readonly MailerInterface $mailer,
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
#[Route('/admin/post')]
#[IsGranted(User::ROLE_ADMIN)]
class BlogController extends AbstractController
final class BlogController extends AbstractController
{
/**
* Lists all Post entities.
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @author Javier Eguiluz <[email protected]>
*/
#[Route('/blog')]
class BlogController extends AbstractController
final class BlogController extends AbstractController
{
/**
* NOTE: For standard formats, Symfony will also automatically choose the best
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/SecurityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @author Ryan Weaver <[email protected]>
* @author Javier Eguiluz <[email protected]>
*/
class SecurityController extends AbstractController
final class SecurityController extends AbstractController
{
use TargetPathTrait;

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @author Romain Monteil <[email protected]>
*/
#[Route('/profile'), IsGranted(User::ROLE_USER)]
class UserController extends AbstractController
final class UserController extends AbstractController
{
#[Route('/edit', name: 'user_edit', methods: ['GET', 'POST'])]
public function edit(
Expand Down
2 changes: 1 addition & 1 deletion src/DataFixtures/AppFixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use Symfony\Component\String\Slugger\SluggerInterface;
use function Symfony\Component\String\u;

class AppFixtures extends Fixture
final class AppFixtures extends Fixture
{
public function __construct(
private readonly UserPasswordHasherInterface $passwordHasher,
Expand Down
2 changes: 1 addition & 1 deletion src/Event/CommentCreatedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use App\Entity\Comment;
use Symfony\Contracts\EventDispatcher\Event;

class CommentCreatedEvent extends Event
final class CommentCreatedEvent extends Event
{
public function __construct(
protected Comment $comment
Expand Down
2 changes: 1 addition & 1 deletion src/EventSubscriber/CheckRequirementsSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*
* @author Javier Eguiluz <[email protected]>
*/
class CheckRequirementsSubscriber implements EventSubscriberInterface
final class CheckRequirementsSubscriber implements EventSubscriberInterface
{
public function __construct(
private readonly EntityManagerInterface $entityManager
Expand Down
2 changes: 1 addition & 1 deletion src/EventSubscriber/CommentNotificationSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* @author Oleg Voronkovich <[email protected]>
*/
class CommentNotificationSubscriber implements EventSubscriberInterface
final class CommentNotificationSubscriber implements EventSubscriberInterface
{
public function __construct(
private readonly MailerInterface $mailer,
Expand Down
2 changes: 1 addition & 1 deletion src/EventSubscriber/ControllerSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @author Ryan Weaver <[email protected]>
* @author Javier Eguiluz <[email protected]>
*/
class ControllerSubscriber implements EventSubscriberInterface
final class ControllerSubscriber implements EventSubscriberInterface
{
public function __construct(
private readonly SourceCodeExtension $twigExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author Oleg Voronkovich <[email protected]>
*/
class RedirectToPreferredLocaleSubscriber implements EventSubscriberInterface
final class RedirectToPreferredLocaleSubscriber implements EventSubscriberInterface
{
/**
* @var string[]
Expand Down
2 changes: 1 addition & 1 deletion src/Form/ChangePasswordType.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author Romain Monteil <[email protected]>
*/
class ChangePasswordType extends AbstractType
final class ChangePasswordType extends AbstractType
{
/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion src/Form/CommentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @author Ryan Weaver <[email protected]>
* @author Javier Eguiluz <[email protected]>
*/
class CommentType extends AbstractType
final class CommentType extends AbstractType
{
/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion src/Form/DataTransformer/TagArrayToStringTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* @template-implements DataTransformerInterface<Tag[], string>
*/
class TagArrayToStringTransformer implements DataTransformerInterface
final class TagArrayToStringTransformer implements DataTransformerInterface
{
public function __construct(
private readonly TagRepository $tags
Expand Down
2 changes: 1 addition & 1 deletion src/Form/PostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @author Javier Eguiluz <[email protected]>
* @author Yonel Ceruto <[email protected]>
*/
class PostType extends AbstractType
final class PostType extends AbstractType
{
// Form types are services, so you can inject other services in them if needed
public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Type/DateTimePickerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* @author Yonel Ceruto <[email protected]>
*/
class DateTimePickerType extends AbstractType
final class DateTimePickerType extends AbstractType
{
public function __construct(
private readonly MomentFormatConverter $formatConverter
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Type/TagsInputType.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*
* @author Yonel Ceruto <[email protected]>
*/
class TagsInputType extends AbstractType
final class TagsInputType extends AbstractType
{
public function __construct(
private readonly TagRepository $tags
Expand Down
2 changes: 1 addition & 1 deletion src/Form/UserType.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @author Romain Monteil <[email protected]>
*/
class UserType extends AbstractType
final class UserType extends AbstractType
{
/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;

class Kernel extends BaseKernel
final class Kernel extends BaseKernel
{
use MicroKernelTrait;
}
2 changes: 1 addition & 1 deletion src/Pagination/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @author Javier Eguiluz <[email protected]>
*/
class Paginator
final class Paginator
{
/**
* Use constants to define configuration options that rarely change instead
Expand Down
2 changes: 1 addition & 1 deletion src/Security/PostVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @author Yonel Ceruto <[email protected]>
*/
class PostVoter extends Voter
final class PostVoter extends Voter
{
// Defining these constants is overkill for this simple application, but for real
// applications, it's a recommended practice to avoid relying on "magic strings"
Expand Down
2 changes: 1 addition & 1 deletion src/Twig/AppExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* @author Javier Eguiluz <[email protected]>
* @author Julien ITARD <[email protected]>
*/
class AppExtension extends AbstractExtension
final class AppExtension extends AbstractExtension
{
/**
* @var string[]
Expand Down
2 changes: 1 addition & 1 deletion src/Twig/SourceCodeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @author Ryan Weaver <[email protected]>
* @author Javier Eguiluz <[email protected]>
*/
class SourceCodeExtension extends AbstractExtension
final class SourceCodeExtension extends AbstractExtension
{
/**
* @var callable|null
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/MomentFormatConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @author Yonel Ceruto <[email protected]>
*/
class MomentFormatConverter
final class MomentFormatConverter
{
/**
* This defines the mapping between PHP ICU date format (key) and moment.js date format (value)
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* @author Javier Eguiluz <[email protected]>
*/
class Validator
final class Validator
{
public function validateUsername(?string $username): string
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/AddUserCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use App\Repository\UserRepository;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;

class AddUserCommandTest extends AbstractCommandTest
final class AddUserCommandTest extends AbstractCommandTest
{
/**
* @var string[]
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/ListUsersCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use App\Command\ListUsersCommand;

class ListUsersCommandTest extends AbstractCommandTest
final class ListUsersCommandTest extends AbstractCommandTest
{
/**
* @dataProvider maxResultsProvider
Expand Down
2 changes: 1 addition & 1 deletion tests/Controller/BlogControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* $ cd your-symfony-project/
* $ ./vendor/bin/phpunit
*/
class BlogControllerTest extends WebTestCase
final class BlogControllerTest extends WebTestCase
{
public function testIndex(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Controller/DefaultControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* $ cd your-symfony-project/
* $ ./vendor/bin/phpunit
*/
class DefaultControllerTest extends WebTestCase
final class DefaultControllerTest extends WebTestCase
{
/**
* PHPUnit's data providers allow to execute the same tests repeated times
Expand Down
2 changes: 1 addition & 1 deletion tests/Controller/UserControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* $ cd your-symfony-project/
* $ ./vendor/bin/phpunit
*/
class UserControllerTest extends WebTestCase
final class UserControllerTest extends WebTestCase
{
/**
* @dataProvider getUrlsForAnonymousUsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* See https://symfony.com/doc/current/testing/database.html
*/
class TagArrayToStringTransformerTest extends TestCase
final class TagArrayToStringTransformerTest extends TestCase
{
/**
* Ensures that tags are created correctly.
Expand Down
2 changes: 1 addition & 1 deletion tests/Utils/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use App\Utils\Validator;
use PHPUnit\Framework\TestCase;

class ValidatorTest extends TestCase
final class ValidatorTest extends TestCase
{
private Validator $validator;

Expand Down