Skip to content

Commit

Permalink
change to readonly class
Browse files Browse the repository at this point in the history
  • Loading branch information
BibaltiK committed Feb 4, 2024
1 parent 78c3ca4 commit f1e3486
Show file tree
Hide file tree
Showing 46 changed files with 62 additions and 51 deletions.
2 changes: 1 addition & 1 deletion src/App/Dto/System/SimpleMessageDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use OpenApi\Attributes as OA;

#[OA\Schema()]
class SimpleMessageDto
readonly class SimpleMessageDto
{
#[OA\Property(
description: 'A message to the API user',
Expand Down
7 changes: 6 additions & 1 deletion src/App/Dto/Topic/TopicCreateFailureMessageDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use OpenApi\Attributes as OA;

#[OA\Schema()]
class TopicCreateFailureMessageDto
readonly class TopicCreateFailureMessageDto
{
#[OA\Property(
properties: [
Expand All @@ -14,4 +14,9 @@ class TopicCreateFailureMessageDto
type: 'object'
)]
public array $topic;

public function __construct(array $topic)
{
$this->topic = $topic;
}
}
8 changes: 7 additions & 1 deletion src/App/Dto/UserContent/UserLogInDataDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use OpenApi\Attributes as OA;

#[OA\Schema(required: ['username', 'password'])]
class UserLogInDataDto
readonly class UserLogInDataDto
{
#[OA\Property(
description: 'The User name',
Expand All @@ -18,4 +18,10 @@ class UserLogInDataDto
type: 'string',
)]
public string $password;

public function __construct(string $username, string $password)
{
$this->username = $username;
$this->password = $password;
}
}
2 changes: 1 addition & 1 deletion src/App/Factory/DatabaseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use PDO;
use Psr\Container\ContainerInterface;

class DatabaseFactory
readonly class DatabaseFactory
{
public function __invoke(ContainerInterface $container): PDO
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Factory/LoggerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use function mkdir;
use function rtrim;

class LoggerFactory
readonly class LoggerFactory
{
public function __invoke(ContainerInterface $container): LoggerInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Factory/MailFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mailer\Transport;

class MailFactory
readonly class MailFactory
{
public function __invoke(ContainerInterface $container): Mailer
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Factory/QueryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PDO;
use Psr\Container\ContainerInterface;

class QueryFactory
readonly class QueryFactory
{
public function __invoke(ContainerInterface $container): Query
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Factory/UuidFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;

class UuidFactory
readonly class UuidFactory
{
public function __invoke(ContainerInterface $container): UuidInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Handler/Authentication/LoginHandlerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Psr\Container\ContainerInterface;

class LoginHandlerFactory
readonly class LoginHandlerFactory
{
public function __invoke(ContainerInterface $container): LoginHandler
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Handler/Authentication/LogoutHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

class LogoutHandler implements RequestHandlerInterface
readonly class LogoutHandler implements RequestHandlerInterface
{
/**
* not implementet yet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

class UserPasswordChangeHandler implements RequestHandlerInterface
readonly class UserPasswordChangeHandler implements RequestHandlerInterface
{
public function handle(ServerRequestInterface $request): ResponseInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Psr\Container\ContainerInterface;
use Symfony\Component\Mailer\Mailer;

class UserPasswordForgottonHandlerFactory
readonly class UserPasswordForgottonHandlerFactory
{
public function __invoke(ContainerInterface $container): UserPasswordForgottonHandler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

class UserPasswordVerifyTokenHandler implements RequestHandlerInterface
readonly class UserPasswordVerifyTokenHandler implements RequestHandlerInterface
{
public function handle(ServerRequestInterface $request): ResponseInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

class UserRegisterSubmitHandler implements RequestHandlerInterface
readonly class UserRegisterSubmitHandler implements RequestHandlerInterface
{
#[OA\Post(path: '/api/user/register', summary: 'Register a user with e-mail', tags: ['User Control'])]
#[OA\RequestBody(
Expand Down
2 changes: 1 addition & 1 deletion src/App/Handler/Event/EventCreateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

class EventCreateHandler implements RequestHandlerInterface
readonly class EventCreateHandler implements RequestHandlerInterface
{
public function handle(ServerRequestInterface $request): ResponseInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Handler/Event/EventNameHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

class EventNameHandler implements RequestHandlerInterface
readonly class EventNameHandler implements RequestHandlerInterface
{
public function handle(ServerRequestInterface $request): ResponseInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

class EventParticipantUnsubscribeHandler implements RequestHandlerInterface
readonly class EventParticipantUnsubscribeHandler implements RequestHandlerInterface
{
public function handle(ServerRequestInterface $request): ResponseInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Handler/System/ApiMeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
openapi: '3.1.0',
security: [['bearerAuth' => []]],
)]
class ApiMeHandler implements RequestHandlerInterface
readonly class ApiMeHandler implements RequestHandlerInterface
{
#[OA\Get(
path: '/api/user/me',
Expand Down
2 changes: 1 addition & 1 deletion src/App/Handler/System/PingHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use function time;

class PingHandler implements RequestHandlerInterface
readonly class PingHandler implements RequestHandlerInterface
{
#[OA\Get(
path: '/api/ping',
Expand Down
2 changes: 1 addition & 1 deletion src/App/Hydrator/ClassMethodsHydratorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Laminas\Hydrator\ClassMethodsHydrator;
use Psr\Container\ContainerInterface;

class ClassMethodsHydratorFactory
readonly class ClassMethodsHydratorFactory
{
public function __invoke(ContainerInterface $container): ClassMethodsHydrator
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Hydrator/DateTimeFormatterStrategyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Laminas\Hydrator\Strategy\DateTimeFormatterStrategy;
use Psr\Container\ContainerInterface;

class DateTimeFormatterStrategyFactory
readonly class DateTimeFormatterStrategyFactory
{
public function __invoke(ContainerInterface $container): DateTimeFormatterStrategy
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Hydrator/NullableStrategyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Laminas\Hydrator\Strategy\NullableStrategy;
use Psr\Container\ContainerInterface;

class NullableStrategyFactory
readonly class NullableStrategyFactory
{
public function __invoke(ContainerInterface $container): NullableStrategy
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Listener/LoggingErrorListenerDelegatorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Laminas\Stratigility\Middleware\ErrorHandler;
use Psr\Container\ContainerInterface;

class LoggingErrorListenerDelegatorFactory
readonly class LoggingErrorListenerDelegatorFactory
{
public function __invoke(ContainerInterface $container, string $name, callable $callback): ErrorHandler
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Listener/LoggingErrorListenerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;

class LoggingErrorListenerFactory
readonly class LoggingErrorListenerFactory
{
public function __invoke(ContainerInterface $container): LoggingErrorListener
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

class IsLoggedInAuthenticationMiddleware implements MiddlewareInterface
readonly class IsLoggedInAuthenticationMiddleware implements MiddlewareInterface
{
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;

class JwtAuthenticationMiddlewareFactory
readonly class JwtAuthenticationMiddlewareFactory
{
public function __invoke(ContainerInterface $container): JwtAuthenticationMiddleware
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Middleware/Event/EventCreateMiddlewareFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Laminas\Hydrator\Strategy\HydratorStrategy;
use Psr\Container\ContainerInterface;

class EventCreateMiddlewareFactory
readonly class EventCreateMiddlewareFactory
{
public function __invoke(ContainerInterface $container): EventCreateMiddleware
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Middleware/System/HttpExceptionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

class HttpExceptionMiddleware implements MiddlewareInterface
readonly class HttpExceptionMiddleware implements MiddlewareInterface
{
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Service/Authentication/ApiAccessService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Service\Authentication;

class ApiAccessService
readonly class ApiAccessService
{
public function __construct(
private readonly array $apiAccessConfig,
Expand Down
2 changes: 1 addition & 1 deletion src/App/Service/Authentication/ApiAccessServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Psr\Container\ContainerInterface;

class ApiAccessServiceFactory
readonly class ApiAccessServiceFactory
{
public function __invoke(ContainerInterface $container): ApiAccessService
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use function password_verify;

class LoginAuthenticationService
readonly class LoginAuthenticationService
{
public function isUserDataCorrect(?User $user, string $password): bool
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Service/EMail/TopicCreateEMailServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Psr\Container\ContainerInterface;
use Symfony\Component\Mailer\Mailer;

class TopicCreateEMailServiceFactory
readonly class TopicCreateEMailServiceFactory
{
public function __invoke(ContainerInterface $container): TopicCreateEMailService
{
Expand Down
6 changes: 3 additions & 3 deletions src/App/Service/Event/EventService.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
use Fig\Http\Message\StatusCodeInterface as HTTP;
use Psr\Log\InvalidArgumentException;

class EventService
readonly class EventService
{
public function __construct(
private readonly EventRepository $repository,
private readonly ReflectionHydrator $hydrator,
private EventRepository $repository,
private ReflectionHydrator $hydrator,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/App/Service/Event/EventServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Laminas\Hydrator\Strategy\DateTimeFormatterStrategy;
use Psr\Container\ContainerInterface;

class EventServiceFactory
readonly class EventServiceFactory
{
public function __invoke(ContainerInterface $container): EventService
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Service/Participant/ParticipantServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Laminas\Hydrator\Strategy\DateTimeFormatterStrategy;
use Psr\Container\ContainerInterface;

class ParticipantServiceFactory
readonly class ParticipantServiceFactory
{
public function __invoke(ContainerInterface $container): ParticipantService
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Service/Project/ProjectServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Laminas\Hydrator\Strategy\DateTimeFormatterStrategy;
use Psr\Container\ContainerInterface;

class ProjectServiceFactory
readonly class ProjectServiceFactory
{
public function __invoke(ContainerInterface $container): ProjectService
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Service/System/TokenService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use function bin2hex;
use function openssl_random_pseudo_bytes;

class TokenService
readonly class TokenService
{
public function generateToken(): string
{
Expand Down
6 changes: 3 additions & 3 deletions src/App/Service/Topic/TopicPoolService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
use JetBrains\PhpStorm\ArrayShape;
use PDOException;

class TopicPoolService
readonly class TopicPoolService
{
public function __construct(
private readonly TopicPoolRepository $repository,
private readonly ReflectionHydrator $hydrator,
private TopicPoolRepository $repository,
private ReflectionHydrator $hydrator,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/App/Service/Topic/TopicPoolServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use App\System\Hydrator\Strategy\UuidStrategy;
use Psr\Container\ContainerInterface;

class TopicPoolServiceFactory
readonly class TopicPoolServiceFactory
{
public function __invoke(ContainerInterface $container): TopicPoolService
{
Expand Down
2 changes: 1 addition & 1 deletion src/App/Service/User/UserServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Psr\Container\ContainerInterface;
use Ramsey\Uuid\Uuid;

class UserServiceFactory
readonly class UserServiceFactory
{
public function __invoke(ContainerInterface $container): UserService
{
Expand Down
Loading

0 comments on commit f1e3486

Please sign in to comment.