Skip to content

Commit

Permalink
style: apply new php cs fixer rules
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezcasas committed Sep 27, 2023
1 parent 15c2952 commit 751c0bc
Show file tree
Hide file tree
Showing 135 changed files with 238 additions and 433 deletions.
2 changes: 2 additions & 0 deletions apps/backoffice/backend/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true],
Expand Down
2 changes: 2 additions & 0 deletions apps/backoffice/backend/public/index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use CodelyTv\Apps\Backoffice\Backend\BackofficeBackendKernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

final readonly class CoursesGetController
{
public function __construct(private QueryBus $queryBus)
{
}
public function __construct(private QueryBus $queryBus) {}

public function __invoke(Request $request): JsonResponse
{
Expand All @@ -30,10 +28,10 @@ public function __invoke(Request $request): JsonResponse
$response = $this->queryBus->ask(
new SearchBackofficeCoursesByCriteriaQuery(
(array) $request->query->get('filters'),
null === $orderBy ? null : (string) $orderBy,
null === $order ? null : (string) $order,
null === $limit ? null : (int) $limit,
null === $offset ? null : (int) $offset
$orderBy === null ? null : (string) $orderBy,
$order === null ? null : (string) $order,
$limit === null ? null : (int) $limit,
$offset === null ? null : (int) $offset
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

final readonly class MetricsController
{
public function __construct(private PrometheusMonitor $monitor)
{
}
public function __construct(private PrometheusMonitor $monitor) {}

public function __invoke(Request $request): Response
{
Expand Down
2 changes: 2 additions & 0 deletions apps/backoffice/frontend/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true],
Expand Down
2 changes: 2 additions & 0 deletions apps/backoffice/frontend/public/index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use CodelyTv\Apps\Backoffice\Frontend\BackofficeFrontendKernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

final readonly class MetricsController
{
public function __construct(private PrometheusMonitor $monitor)
{
}
public function __construct(private PrometheusMonitor $monitor) {}

public function __invoke(Request $request): Response
{
Expand Down
4 changes: 3 additions & 1 deletion apps/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Symfony\Component\Dotenv\Dotenv;

$rootPath = dirname(__DIR__);
Expand All @@ -23,6 +25,6 @@

$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] ??= $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] ??= $_ENV['APP_DEBUG'] ?? $_SERVER['APP_ENV'] !== 'prod';
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] =
(int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
2 changes: 2 additions & 0 deletions apps/mooc/backend/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true],
Expand Down
2 changes: 2 additions & 0 deletions apps/mooc/backend/public/index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use CodelyTv\Apps\Mooc\Backend\MoocBackendKernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,7 @@ private function configCreator(string $path): callable
$subscriberName = RabbitMqQueueNameFormatter::shortFormat($subscriber);

$fileContent = str_replace(
[
'{subscriber_name}',
'{queue_name}',
'{path}',
'{processes}',
'{events_to_process}',
],
['{subscriber_name}', '{queue_name}', '{path}', '{processes}', '{events_to_process}', ],
[
$subscriberName,
$queueName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

final readonly class HealthCheckGetController
{
public function __construct(private RandomNumberGenerator $generator)
{
}
public function __construct(private RandomNumberGenerator $generator) {}

public function __invoke(Request $request): JsonResponse
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

final readonly class MetricsController
{
public function __construct(private PrometheusMonitor $monitor)
{
}
public function __construct(private PrometheusMonitor $monitor) {}

public function __invoke(Request $request): Response
{
Expand Down
16 changes: 7 additions & 9 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@
use PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
use PhpCsFixer\Fixer\Strict\StrictParamFixer;
use PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer;
use PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer;
use PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer;
use PhpCsFixer\Fixer\Whitespace\TypesSpacesFixer;
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
use Symplify\CodingStandard\Fixer\Spacing\MethodChainingNewlineFixer;
use Symplify\CodingStandard\Fixer\Strict\BlankLineAfterStrictTypesFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
Expand All @@ -71,24 +70,21 @@
GlobalNamespaceImportFixer::class,
NoLeadingImportSlashFixer::class,
// Arrays
ArrayListItemNewlineFixer::class,
ArrayOpenerAndCloserNewlineFixer::class,
TrimArraySpacesFixer::class,
// Blank lines
BlankLineAfterStrictTypesFixer::class,
NoBlankLinesAfterClassOpeningFixer::class,
// Spacing
MethodChainingNewlineFixer::class,
SingleLineEmptyBodyFixer::class,
CastSpacesFixer::class,
TypeDeclarationSpacesFixer::class,
TypesSpacesFixer::class,
// Casing
ClassReferenceNameCasingFixer::class,
LowercaseStaticReferenceFixer::class,
MagicMethodCasingFixer::class,
NativeFunctionCasingFixer::class,
NativeFunctionTypeDeclarationCasingFixer::class,
// Order
OrderedTypesFixer::class,
// Architecture
FinalClassFixer::class,
FinalPublicMethodForAbstractClassFixer::class,
Expand Down Expand Up @@ -121,10 +117,12 @@
DeclareStrictTypesFixer::class,
StrictComparisonFixer::class,
SingleQuoteFixer::class,
StatementIndentationFixer::class,
]);

$ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, ['syntax' => 'short']);
$ecsConfig->ruleWithConfiguration(LineLengthFixer::class, [LineLengthFixer::LINE_LENGTH => 120]);
$ecsConfig->ruleWithConfiguration(YodaStyleFixer::class, ['equal' => false, 'identical' => false, 'less_and_greater' => false]);
$ecsConfig->ruleWithConfiguration(PhpUnitMethodCasingFixer::class, ['case' => PhpUnitMethodCasingFixer::SNAKE_CASE]);
$ecsConfig->ruleWithConfiguration(OrderedTypesFixer::class, ['null_adjustment' => 'always_last']);
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

final readonly class DomainEventStorer
{
public function __construct(private DomainEventsRepository $repository)
{
}
public function __construct(private DomainEventsRepository $repository) {}

public function store(
AnalyticsDomainEventId $id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

final readonly class StoreDomainEventOnOccurred implements DomainEventSubscriber
{
public function __construct(private DomainEventStorer $storer)
{
}
public function __construct(private DomainEventStorer $storer) {}

public static function subscribedTo(): array
{
Expand Down
3 changes: 1 addition & 2 deletions src/Analytics/DomainEvents/Domain/AnalyticsDomainEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ public function __construct(
private AnalyticsDomainEventAggregateId $aggregateId,
private AnalyticsDomainEventName $name,
private AnalyticsDomainEventBody $body
) {
}
) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use CodelyTv\Shared\Domain\ValueObject\Uuid;

final class AnalyticsDomainEventAggregateId extends Uuid
{
}
final class AnalyticsDomainEventAggregateId extends Uuid {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

final readonly class AnalyticsDomainEventBody
{
public function __construct(private array $value)
{
}
public function __construct(private array $value) {}

public function value(): array
{
Expand Down
4 changes: 1 addition & 3 deletions src/Analytics/DomainEvents/Domain/AnalyticsDomainEventId.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use CodelyTv\Shared\Domain\ValueObject\Uuid;

final class AnalyticsDomainEventId extends Uuid
{
}
final class AnalyticsDomainEventId extends Uuid {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use CodelyTv\Shared\Domain\ValueObject\StringValueObject;

final class AnalyticsDomainEventName extends StringValueObject
{
}
final class AnalyticsDomainEventName extends StringValueObject {}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

final readonly class AuthenticateUserCommand implements Command
{
public function __construct(private string $username, private string $password)
{
}
public function __construct(private string $username, private string $password) {}

public function username(): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

final readonly class AuthenticateUserCommandHandler implements CommandHandler
{
public function __construct(private UserAuthenticator $authenticator)
{
}
public function __construct(private UserAuthenticator $authenticator) {}

public function __invoke(AuthenticateUserCommand $command): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

final readonly class UserAuthenticator
{
public function __construct(private AuthRepository $repository)
{
}
public function __construct(private AuthRepository $repository) {}

public function authenticate(AuthUsername $username, AuthPassword $password): void
{
Expand All @@ -27,7 +25,7 @@ public function authenticate(AuthUsername $username, AuthPassword $password): vo

private function ensureUserExist(?AuthUser $auth, AuthUsername $username): void
{
if (null === $auth) {
if ($auth === null) {
throw new InvalidAuthUsername($username);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Backoffice/Auth/Domain/AuthPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

final class AuthPassword extends StringValueObject
{
public function isEquals(AuthPassword $other): bool
public function isEquals(self $other): bool
{
return $this->value() === $other->value();
}
Expand Down
4 changes: 1 addition & 3 deletions src/Backoffice/Auth/Domain/AuthUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

final readonly class AuthUser
{
public function __construct(private AuthUsername $username, private AuthPassword $password)
{
}
public function __construct(private AuthUsername $username, private AuthPassword $password) {}

public function passwordMatches(AuthPassword $password): bool
{
Expand Down
4 changes: 1 addition & 3 deletions src/Backoffice/Auth/Domain/AuthUsername.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use CodelyTv\Shared\Domain\ValueObject\StringValueObject;

final class AuthUsername extends StringValueObject
{
}
final class AuthUsername extends StringValueObject {}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public function search(AuthUsername $username): ?AuthUser
{
$password = get($username->value(), self::USERS);

return null !== $password ? new AuthUser($username, new AuthPassword($password)) : null;
return $password !== null ? new AuthUser($username, new AuthPassword($password)) : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

final readonly class BackofficeCourseResponse
{
public function __construct(private string $id, private string $name, private string $duration)
{
}
public function __construct(private string $id, private string $name, private string $duration) {}

public function id(): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

final readonly class BackofficeCourseCreator
{
public function __construct(private BackofficeCourseRepository $repository)
{
}
public function __construct(private BackofficeCourseRepository $repository) {}

public function create(string $id, string $name, string $duration): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

final readonly class CreateBackofficeCourseOnCourseCreated implements DomainEventSubscriber
{
public function __construct(private BackofficeCourseCreator $creator)
{
}
public function __construct(private BackofficeCourseCreator $creator) {}

public static function subscribedTo(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

final readonly class AllBackofficeCoursesSearcher
{
public function __construct(private BackofficeCourseRepository $repository)
{
}
public function __construct(private BackofficeCourseRepository $repository) {}

public function searchAll(): BackofficeCoursesResponse
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use CodelyTv\Shared\Domain\Bus\Query\Query;

final class SearchAllBackofficeCoursesQuery implements Query
{
}
final class SearchAllBackofficeCoursesQuery implements Query {}
Loading

0 comments on commit 751c0bc

Please sign in to comment.