Skip to content

Commit

Permalink
Added #[Override] attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
tarlepp committed Oct 20, 2024
1 parent 3482f67 commit 9a987f9
Show file tree
Hide file tree
Showing 83 changed files with 241 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/AutoMapper/RestAutoMapperConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use AutoMapperPlus\AutoMapperPlusBundle\AutoMapperConfiguratorInterface;
use AutoMapperPlus\Configuration\AutoMapperConfigInterface;
use AutoMapperPlus\MapperInterface;
use Override;
use Symfony\Component\HttpFoundation\Request;

/**
Expand All @@ -36,6 +37,7 @@ public function __construct(
*
* @psalm-suppress UndefinedThisPropertyFetch
*/
#[Override]
public function configure(AutoMapperConfigInterface $config): void
{
foreach (static::$requestMapperClasses as $requestMapperClass) {
Expand Down
3 changes: 3 additions & 0 deletions src/AutoMapper/RestRequestMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use AutoMapperPlus\MapperInterface;
use InvalidArgumentException;
use LengthException;
use Override;
use ReflectionClass;
use ReflectionNamedType;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -41,6 +42,7 @@ abstract class RestRequestMapper implements MapperInterface
* @psalm-param array<array-key, mixed>|object $source
* @psalm-param array<int, mixed> $context
*/
#[Override]
public function map($source, string $targetClass, array $context = []): RestDtoInterface
{
/** @psalm-var class-string $targetClass */
Expand All @@ -56,6 +58,7 @@ public function map($source, string $targetClass, array $context = []): RestDtoI
* @psalm-param object $destination
* @psalm-param array<int, mixed> $context
*/
#[Override]
public function mapToObject($source, $destination, array $context = []): RestDtoInterface
{
if (!is_object($source)) {
Expand Down
2 changes: 2 additions & 0 deletions src/Command/ApiKey/ChangeTokenCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Command\Traits\SymfonyStyleTrait;
use App\Entity\ApiKey;
use App\Resource\ApiKeyResource;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -43,6 +44,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
3 changes: 3 additions & 0 deletions src/Command/ApiKey/CreateApiKeyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use App\Resource\UserGroupResource;
use App\Security\RolesService;
use Matthias\SymfonyConsoleForm\Console\Helper\FormHelper;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -65,6 +66,7 @@ public function getRolesService(): RolesService
return $this->rolesService;
}

#[Override]
protected function configure(): void
{
parent::configure();
Expand All @@ -77,6 +79,7 @@ protected function configure(): void
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
2 changes: 2 additions & 0 deletions src/Command/ApiKey/EditApiKeyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use App\Form\Type\Console\ApiKeyType;
use App\Resource\ApiKeyResource;
use Matthias\SymfonyConsoleForm\Console\Helper\FormHelper;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -46,6 +47,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
2 changes: 2 additions & 0 deletions src/Command/ApiKey/ListApiKeysCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use App\Resource\ApiKeyResource;
use App\Security\RolesService;
use Closure;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -47,6 +48,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
Expand Down
2 changes: 2 additions & 0 deletions src/Command/ApiKey/RemoveApiKeyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Command\Traits\SymfonyStyleTrait;
use App\Entity\ApiKey;
use App\Resource\ApiKeyResource;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -43,6 +44,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
2 changes: 2 additions & 0 deletions src/Command/User/CreateRolesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use App\Repository\RoleRepository;
use App\Security\RolesService;
use Doctrine\ORM\EntityManagerInterface;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -49,6 +50,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
3 changes: 3 additions & 0 deletions src/Command/User/CreateUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use App\Resource\UserResource;
use App\Security\RolesService;
use Matthias\SymfonyConsoleForm\Console\Helper\FormHelper;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -87,6 +88,7 @@ public function getRolesService(): RolesService
return $this->rolesService;
}

#[Override]
protected function configure(): void
{
parent::configure();
Expand All @@ -99,6 +101,7 @@ protected function configure(): void
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
3 changes: 3 additions & 0 deletions src/Command/User/CreateUserGroupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use App\Repository\RoleRepository;
use App\Resource\UserGroupResource;
use Matthias\SymfonyConsoleForm\Console\Helper\FormHelper;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
Expand Down Expand Up @@ -60,6 +61,7 @@ public function __construct(
parent::__construct();
}

#[Override]
protected function configure(): void
{
parent::configure();
Expand All @@ -72,6 +74,7 @@ protected function configure(): void
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
2 changes: 2 additions & 0 deletions src/Command/User/EditUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use App\Form\Type\Console\UserType;
use App\Resource\UserResource;
use Matthias\SymfonyConsoleForm\Console\Helper\FormHelper;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -46,6 +47,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
2 changes: 2 additions & 0 deletions src/Command/User/EditUserGroupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use App\Form\Type\Console\UserGroupType;
use App\Resource\UserGroupResource;
use Matthias\SymfonyConsoleForm\Console\Helper\FormHelper;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -46,6 +47,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
2 changes: 2 additions & 0 deletions src/Command/User/ListUserGroupsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use App\Entity\UserGroup;
use App\Resource\UserGroupResource;
use Closure;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -47,6 +48,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
2 changes: 2 additions & 0 deletions src/Command/User/ListUsersCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use App\Resource\UserResource;
use App\Security\RolesService;
use Closure;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -49,6 +50,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
2 changes: 2 additions & 0 deletions src/Command/User/RemoveUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Command\Traits\SymfonyStyleTrait;
use App\Entity\User;
use App\Resource\UserResource;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -43,6 +44,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
2 changes: 2 additions & 0 deletions src/Command/User/RemoveUserGroupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Command\Traits\SymfonyStyleTrait;
use App\Entity\UserGroup;
use App\Resource\UserGroupResource;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -43,6 +44,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getSymfonyStyle($input, $output);
Expand Down
2 changes: 2 additions & 0 deletions src/Command/Utils/CheckDependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use InvalidArgumentException;
use JsonException;
use LogicException;
use Override;
use SplFileInfo;
use stdClass;
use Symfony\Component\Console\Attribute\AsCommand;
Expand Down Expand Up @@ -81,6 +82,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$onlyMinor = $input->getOption('minor');
Expand Down
2 changes: 2 additions & 0 deletions src/Command/Utils/CreateDateDimensionEntitiesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use DateTimeImmutable;
use DateTimeZone;
use InvalidArgumentException;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
Expand Down Expand Up @@ -49,6 +50,7 @@ public function __construct(
*
* @throws Throwable
*/
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
// Create output decorator helpers for the Symfony Style Guide.
Expand Down
2 changes: 2 additions & 0 deletions src/Compiler/StopwatchCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace App\Compiler;

use App\Decorator\StopwatchDecorator;
use Override;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
Expand All @@ -29,6 +30,7 @@ class StopwatchCompilerPass implements CompilerPassInterface
'app.stopwatch',
];

#[Override]
public function process(ContainerBuilder $container): void
{
foreach (self::SERVICE_TAGS as $tag) {
Expand Down
2 changes: 2 additions & 0 deletions src/DTO/ApiKey/ApiKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use App\Entity\Interfaces\UserGroupAwareInterface;
use App\Entity\UserGroup as UserGroupEntity;
use App\Validator\Constraints as AppAssert;
use Override;
use Symfony\Component\Validator\Constraints as Assert;
use function array_map;

Expand Down Expand Up @@ -97,6 +98,7 @@ public function setUserGroups(array $userGroups): self
*
* @param EntityInterface|Entity $entity
*/
#[Override]
public function load(EntityInterface $entity): self
{
if ($entity instanceof Entity) {
Expand Down
6 changes: 6 additions & 0 deletions src/DTO/RestDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Entity\Interfaces\EntityInterface;
use BadMethodCallException;
use LogicException;
use Override;
use function array_filter;
use function array_key_exists;
use function count;
Expand Down Expand Up @@ -51,6 +52,7 @@ abstract class RestDto implements RestDtoInterface
*/
private array $visited = [];

#[Override]
public function setId(string $id): self
{
$this->setVisited('id');
Expand All @@ -65,18 +67,21 @@ public function getId(): ?string
return $this->id;
}

#[Override]
public function getVisited(): array
{
return array_filter($this->visited, static fn (string $property): bool => $property !== 'id');
}

#[Override]
public function setVisited(string $property): self
{
$this->visited[] = $property;

return $this;
}

#[Override]
public function update(EntityInterface $entity): EntityInterface
{
foreach ($this->getVisited() as $property) {
Expand All @@ -96,6 +101,7 @@ public function update(EntityInterface $entity): EntityInterface
return $entity;
}

#[Override]
public function patch(RestDtoInterface $dto): self
{
foreach ($dto->getVisited() as $property) {
Expand Down
Loading

0 comments on commit 9a987f9

Please sign in to comment.