Skip to content

Commit

Permalink
Merge pull request #280 from dotkernel/issue-266
Browse files Browse the repository at this point in the history
Issue #266: Replaced annotation-based dependency injection with attribute-based dependency injection
  • Loading branch information
arhimede committed Jun 11, 2024
2 parents fb32a22 + 76e883e commit ace75bc
Show file tree
Hide file tree
Showing 45 changed files with 260 additions and 286 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
},
"require": {
"php": "~8.2.0 || ~8.3.0",
"ext-json": "*",
"ext-gd": "*",
"dotkernel/dot-annotated-services": "^4.1.7",
"ext-json": "*",
"dotkernel/dot-cache": "^4.0",
"dotkernel/dot-cli": "^3.5.0",
"dotkernel/dot-data-fixtures": "^1.1.3",
"dotkernel/dot-dependency-injection": "^1.0",
"dotkernel/dot-errorhandler": "^3.3.2",
"dotkernel/dot-mail": "^4.1.1",
"dotkernel/dot-response-header": "^3.2.3",
Expand Down
2 changes: 1 addition & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class_exists(Mezzio\Tooling\ConfigProvider::class)
Dot\Cli\ConfigProvider::class,

Check warning on line 44 in config/config.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ConfigProvider'
Dot\Log\ConfigProvider::class,
Dot\ErrorHandler\ConfigProvider::class,
Dot\AnnotatedServices\ConfigProvider::class,
Dot\DependencyInjection\ConfigProvider::class,

Check warning on line 47 in config/config.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ConfigProvider'
Dot\ResponseHeader\ConfigProvider::class,

Check warning on line 48 in config/config.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ConfigProvider'
Dot\Mail\ConfigProvider::class,
Dot\DataFixtures\ConfigProvider::class,
Expand Down
18 changes: 9 additions & 9 deletions src/Admin/src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
use Api\Admin\Service\AdminService;
use Api\Admin\Service\AdminServiceInterface;
use Api\App\ConfigProvider as AppConfigProvider;
use Dot\AnnotatedServices\Factory\AnnotatedRepositoryFactory;
use Dot\AnnotatedServices\Factory\AnnotatedServiceFactory;
use Dot\DependencyInjection\Factory\AttributedRepositoryFactory;

Check warning on line 23 in src/Admin/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'AttributedRepositoryFactory'
use Dot\DependencyInjection\Factory\AttributedServiceFactory;
use Mezzio\Hal\Metadata\MetadataMap;

class ConfigProvider
Expand All @@ -38,14 +38,14 @@ public function getDependencies(): array
{
return [
'factories' => [
AdminHandler::class => AnnotatedServiceFactory::class,
AdminAccountHandler::class => AnnotatedServiceFactory::class,
AdminRoleHandler::class => AnnotatedServiceFactory::class,
AdminService::class => AnnotatedServiceFactory::class,
AdminRoleService::class => AnnotatedServiceFactory::class,
AdminHandler::class => AttributedServiceFactory::class,

Check warning on line 41 in src/Admin/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'AttributedServiceFactory'
AdminAccountHandler::class => AttributedServiceFactory::class,
AdminRoleHandler::class => AttributedServiceFactory::class,
AdminService::class => AttributedServiceFactory::class,

Check warning on line 44 in src/Admin/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'AttributedServiceFactory'
AdminRoleService::class => AttributedServiceFactory::class,

Check warning on line 45 in src/Admin/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'AttributedServiceFactory'
AdminCreateCommand::class => AdminCreateCommandFactory::class,
AdminRepository::class => AnnotatedRepositoryFactory::class,
AdminRoleRepository::class => AnnotatedRepositoryFactory::class,
AdminRepository::class => AttributedRepositoryFactory::class,

Check warning on line 47 in src/Admin/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'AttributedRepositoryFactory'
AdminRoleRepository::class => AttributedRepositoryFactory::class,

Check warning on line 48 in src/Admin/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'AttributedRepositoryFactory'
],
'aliases' => [
AdminServiceInterface::class => AdminService::class,
Expand Down
16 changes: 7 additions & 9 deletions src/Admin/src/Handler/AdminAccountHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Api\App\Exception\ConflictException;
use Api\App\Exception\NotFoundException;
use Api\App\Handler\HandlerTrait;
use Dot\AnnotatedServices\Annotation\Inject;
use Dot\DependencyInjection\Attribute\Inject;

Check warning on line 14 in src/Admin/src/Handler/AdminAccountHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Inject'
use Mezzio\Hal\HalResponseFactory;

Check warning on line 15 in src/Admin/src/Handler/AdminAccountHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'HalResponseFactory'
use Mezzio\Hal\ResourceGenerator;

Check warning on line 16 in src/Admin/src/Handler/AdminAccountHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ResourceGenerator'
use Psr\Http\Message\ResponseInterface;
Expand All @@ -22,14 +22,12 @@ class AdminAccountHandler implements RequestHandlerInterface
{
use HandlerTrait;

/**
* @Inject({
* HalResponseFactory::class,
* ResourceGenerator::class,
* AdminServiceInterface::class,
* "config"
* })
*/
#[Inject(
HalResponseFactory::class,
ResourceGenerator::class,
AdminServiceInterface::class,
"config",
)]
public function __construct(
protected HalResponseFactory $responseFactory,
protected ResourceGenerator $resourceGenerator,

Check warning on line 33 in src/Admin/src/Handler/AdminAccountHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ResourceGenerator'
Expand Down
16 changes: 7 additions & 9 deletions src/Admin/src/Handler/AdminHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Api\App\Exception\ConflictException;
use Api\App\Exception\NotFoundException;
use Api\App\Handler\HandlerTrait;
use Dot\AnnotatedServices\Annotation\Inject;
use Dot\DependencyInjection\Attribute\Inject;
use Mezzio\Hal\HalResponseFactory;
use Mezzio\Hal\ResourceGenerator;

Check warning on line 16 in src/Admin/src/Handler/AdminHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ResourceGenerator'
use Psr\Http\Message\ResponseInterface;

Check warning on line 17 in src/Admin/src/Handler/AdminHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ResponseInterface'
Expand All @@ -22,14 +22,12 @@ class AdminHandler implements RequestHandlerInterface
{
use HandlerTrait;

/**
* @Inject({
* HalResponseFactory::class,
* ResourceGenerator::class,
* AdminServiceInterface::class,
* "config",
* })
*/
#[Inject(

Check warning on line 25 in src/Admin/src/Handler/AdminHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Inject'
HalResponseFactory::class,

Check warning on line 26 in src/Admin/src/Handler/AdminHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'HalResponseFactory'
ResourceGenerator::class,
AdminServiceInterface::class,
"config",
)]
public function __construct(
protected HalResponseFactory $responseFactory,
protected ResourceGenerator $resourceGenerator,
Expand Down
16 changes: 7 additions & 9 deletions src/Admin/src/Handler/AdminRoleHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Api\Admin\Service\AdminRoleServiceInterface;
use Api\App\Exception\NotFoundException;
use Api\App\Handler\HandlerTrait;
use Dot\AnnotatedServices\Annotation\Inject;
use Dot\DependencyInjection\Attribute\Inject;

Check warning on line 10 in src/Admin/src/Handler/AdminRoleHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Inject'
use Mezzio\Hal\HalResponseFactory;

Check warning on line 11 in src/Admin/src/Handler/AdminRoleHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'HalResponseFactory'
use Mezzio\Hal\ResourceGenerator;

Check warning on line 12 in src/Admin/src/Handler/AdminRoleHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ResourceGenerator'
use Psr\Http\Message\ResponseInterface;

Check warning on line 13 in src/Admin/src/Handler/AdminRoleHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ResponseInterface'
Expand All @@ -18,14 +18,12 @@ class AdminRoleHandler implements RequestHandlerInterface
{
use HandlerTrait;

/**
* @Inject({
* HalResponseFactory::class,
* ResourceGenerator::class,
* AdminRoleServiceInterface::class,
* "config"
* })
*/
#[Inject(
HalResponseFactory::class,

Check warning on line 22 in src/Admin/src/Handler/AdminRoleHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'HalResponseFactory'
ResourceGenerator::class,

Check warning on line 23 in src/Admin/src/Handler/AdminRoleHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ResourceGenerator'
AdminRoleServiceInterface::class,
"config",
)]
public function __construct(
protected HalResponseFactory $responseFactory,

Check warning on line 28 in src/Admin/src/Handler/AdminRoleHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'HalResponseFactory'
protected ResourceGenerator $resourceGenerator,

Check warning on line 29 in src/Admin/src/Handler/AdminRoleHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ResourceGenerator'
Expand Down
4 changes: 2 additions & 2 deletions src/Admin/src/Repository/AdminRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
use Api\App\Helper\PaginationHelper;
use Api\App\Message;
use Doctrine\ORM\EntityRepository;
use Dot\AnnotatedServices\Annotation\Entity;
use Dot\DependencyInjection\Attribute\Entity;

Check warning on line 13 in src/Admin/src/Repository/AdminRepository.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Entity'

/**
* @Entity(name="Api\Admin\Entity\Admin")
* @extends EntityRepository<object>

Check warning on line 16 in src/Admin/src/Repository/AdminRepository.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'EntityRepository'
*/
#[Entity(name: Admin::class)]

Check warning on line 18 in src/Admin/src/Repository/AdminRepository.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Entity'
class AdminRepository extends EntityRepository
{
public function deleteAdmin(Admin $admin): void
Expand Down
4 changes: 2 additions & 2 deletions src/Admin/src/Repository/AdminRoleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
use Api\Admin\Entity\AdminRole;
use Api\App\Helper\PaginationHelper;
use Doctrine\ORM\EntityRepository;

Check warning on line 10 in src/Admin/src/Repository/AdminRoleRepository.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'EntityRepository'
use Dot\AnnotatedServices\Annotation\Entity;
use Dot\DependencyInjection\Attribute\Entity;

Check warning on line 11 in src/Admin/src/Repository/AdminRoleRepository.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Entity'

/**
* @Entity(name="Api\Admin\Entity\AdminRole")
* @extends EntityRepository<object>

Check warning on line 14 in src/Admin/src/Repository/AdminRoleRepository.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'EntityRepository'
*/
#[Entity(name: AdminRole::class)]
class AdminRoleRepository extends EntityRepository

Check warning on line 17 in src/Admin/src/Repository/AdminRoleRepository.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'EntityRepository'
{
public function getAdminRoles(array $filters = []): AdminRoleCollection
Expand Down
12 changes: 5 additions & 7 deletions src/Admin/src/Service/AdminRoleService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@
use Api\Admin\Repository\AdminRoleRepository;
use Api\App\Exception\NotFoundException;
use Api\App\Message;
use Dot\AnnotatedServices\Annotation\Inject;
use Dot\DependencyInjection\Attribute\Inject;

class AdminRoleService implements AdminRoleServiceInterface
{
/**
* @Inject({
* AdminRoleRepository::class
* })
*/
#[Inject(
AdminRoleRepository::class,
)]
public function __construct(
protected AdminRoleRepository $adminRoleRepository
protected AdminRoleRepository $adminRoleRepository,
) {
}

Expand Down
14 changes: 6 additions & 8 deletions src/Admin/src/Service/AdminService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,17 @@
use Api\App\Exception\ConflictException;
use Api\App\Exception\NotFoundException;
use Api\App\Message;
use Dot\AnnotatedServices\Annotation\Inject;
use Dot\DependencyInjection\Attribute\Inject;

Check warning on line 14 in src/Admin/src/Service/AdminService.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Inject'

class AdminService implements AdminServiceInterface
{
/**
* @Inject({
* AdminRoleService::class,
* AdminRepository::class
* })
*/
#[Inject(

Check warning on line 18 in src/Admin/src/Service/AdminService.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Inject'
AdminRoleService::class,
AdminRepository::class,
)]
public function __construct(
protected AdminRoleService $adminRoleService,
protected AdminRepository $adminRepository
protected AdminRepository $adminRepository,
) {
}

Expand Down
12 changes: 6 additions & 6 deletions src/App/src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Api\App\Service\ErrorReportServiceInterface;
use Doctrine\ORM\EntityManager;

Check warning on line 21 in src/App/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'EntityManager'
use Doctrine\ORM\EntityManagerInterface;
use Dot\AnnotatedServices\Factory\AnnotatedServiceFactory;
use Dot\DependencyInjection\Factory\AttributedServiceFactory;

Check warning on line 23 in src/App/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'AttributedServiceFactory'
use Dot\Mail\Factory\MailOptionsAbstractFactory;

Check warning on line 24 in src/App/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'MailOptionsAbstractFactory'
use Dot\Mail\Factory\MailServiceAbstractFactory;
use Dot\Mail\Service\MailService;

Check warning on line 26 in src/App/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'MailService'
Expand Down Expand Up @@ -64,16 +64,16 @@ public function getDependencies(): array
'dot-mail.options.default' => MailOptionsAbstractFactory::class,
'dot-mail.service.default' => MailServiceAbstractFactory::class,
AuthenticationMiddleware::class => AuthenticationMiddlewareFactory::class,
AuthorizationMiddleware::class => AnnotatedServiceFactory::class,
ContentNegotiationMiddleware::class => AnnotatedServiceFactory::class,
AuthorizationMiddleware::class => AttributedServiceFactory::class,
ContentNegotiationMiddleware::class => AttributedServiceFactory::class,
Environment::class => TwigEnvironmentFactory::class,

Check warning on line 69 in src/App/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Environment'
TwigExtension::class => TwigExtensionFactory::class,

Check warning on line 70 in src/App/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'TwigExtensionFactory'
TwigRenderer::class => TwigRendererFactory::class,
HomeHandler::class => AnnotatedServiceFactory::class,
ErrorResponseMiddleware::class => AnnotatedServiceFactory::class,
HomeHandler::class => AttributedServiceFactory::class,

Check warning on line 72 in src/App/src/ConfigProvider.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'AttributedServiceFactory'
ErrorResponseMiddleware::class => AttributedServiceFactory::class,
RouteListCommand::class => RouteListCommandFactory::class,
TokenGenerateCommand::class => TokenGenerateCommandFactory::class,
ErrorReportService::class => AnnotatedServiceFactory::class,
ErrorReportService::class => AttributedServiceFactory::class,
EntityListenerResolver::class => EntityListenerResolverFactory::class,
],
'aliases' => [
Expand Down
20 changes: 7 additions & 13 deletions src/App/src/Handler/ErrorReportHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
use Api\App\Exception\ForbiddenException;
use Api\App\Message;
use Api\App\Service\ErrorReportServiceInterface;
use Dot\AnnotatedServices\Annotation\Inject;
use Dot\AnnotatedServices\Annotation\Service;
use Dot\DependencyInjection\Attribute\Inject;

Check warning on line 10 in src/App/src/Handler/ErrorReportHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Inject'
use Fig\Http\Message\StatusCodeInterface;

Check warning on line 11 in src/App/src/Handler/ErrorReportHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'StatusCodeInterface'
use Mezzio\Hal\HalResponseFactory;
use Mezzio\Hal\ResourceGenerator;

Check warning on line 13 in src/App/src/Handler/ErrorReportHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ResourceGenerator'
Expand All @@ -17,21 +16,16 @@
use Psr\Http\Server\RequestHandlerInterface;

Check warning on line 16 in src/App/src/Handler/ErrorReportHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'RequestHandlerInterface'
use RuntimeException;

/**
* @Service
*/
class ErrorReportHandler implements RequestHandlerInterface
{
use HandlerTrait;

/**
* @Inject({
* HalResponseFactory::class,
* ResourceGenerator::class,
* ErrorReportServiceInterface::class,
* "config"
* })
*/
#[Inject(

Check warning on line 23 in src/App/src/Handler/ErrorReportHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Inject'
HalResponseFactory::class,
ResourceGenerator::class,
ErrorReportServiceInterface::class,
"config",
)]
public function __construct(
protected HalResponseFactory $responseFactory,

Check warning on line 30 in src/App/src/Handler/ErrorReportHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'HalResponseFactory'
protected ResourceGenerator $resourceGenerator,

Check warning on line 31 in src/App/src/Handler/ErrorReportHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ResourceGenerator'
Expand Down
14 changes: 6 additions & 8 deletions src/App/src/Handler/HomeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Api\App\Handler;

use Dot\AnnotatedServices\Annotation\Inject;
use Dot\DependencyInjection\Attribute\Inject;
use Mezzio\Hal\HalResponseFactory;
use Mezzio\Hal\ResourceGenerator;
use Psr\Http\Message\ResponseInterface;
Expand All @@ -14,13 +14,11 @@ class HomeHandler implements RequestHandlerInterface
{
use HandlerTrait;

/**
* @Inject({
* HalResponseFactory::class,
* ResourceGenerator::class,
* "config"
* })
*/
#[Inject(

Check warning on line 17 in src/App/src/Handler/HomeHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Inject'
HalResponseFactory::class,

Check warning on line 18 in src/App/src/Handler/HomeHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'HalResponseFactory'
ResourceGenerator::class,
"config",
)]
public function __construct(
protected HalResponseFactory $responseFactory,
protected ResourceGenerator $resourceGenerator,

Check warning on line 24 in src/App/src/Handler/HomeHandler.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ResourceGenerator'
Expand Down
16 changes: 7 additions & 9 deletions src/App/src/Middleware/AuthorizationMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Api\App\UserIdentity;
use Api\User\Entity\User;
use Api\User\Repository\UserRepository;
use Dot\AnnotatedServices\Annotation\Inject;
use Dot\DependencyInjection\Attribute\Inject;

Check warning on line 15 in src/App/src/Middleware/AuthorizationMiddleware.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Inject'
use Fig\Http\Message\StatusCodeInterface;

Check warning on line 16 in src/App/src/Middleware/AuthorizationMiddleware.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'StatusCodeInterface'
use Laminas\Diactoros\Response\JsonResponse;

Check warning on line 17 in src/App/src/Middleware/AuthorizationMiddleware.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'JsonResponse'
use Mezzio\Authentication\UserInterface;

Check warning on line 18 in src/App/src/Middleware/AuthorizationMiddleware.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'UserInterface'
Expand All @@ -27,17 +27,15 @@

class AuthorizationMiddleware implements MiddlewareInterface
{
/**
* @Inject({
* AuthorizationInterface::class,
* UserRepository::class,
* AdminRepository::class
* })
*/
#[Inject(

Check warning on line 30 in src/App/src/Middleware/AuthorizationMiddleware.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Inject'
AuthorizationInterface::class,

Check warning on line 31 in src/App/src/Middleware/AuthorizationMiddleware.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'AuthorizationInterface'
UserRepository::class,
AdminRepository::class,
)]
public function __construct(
protected AuthorizationInterface $authorization,
protected UserRepository $userRepository,
protected AdminRepository $adminRepository
protected AdminRepository $adminRepository,
) {
}

Expand Down
13 changes: 7 additions & 6 deletions src/App/src/Middleware/ContentNegotiationMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Api\App\Middleware;

use Api\App\Handler\ResponseTrait;
use Dot\AnnotatedServices\Annotation\Inject;
use Dot\DependencyInjection\Attribute\Inject;

Check warning on line 8 in src/App/src/Middleware/ContentNegotiationMiddleware.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Inject'
use Mezzio\Router\RouteResult;

Check warning on line 9 in src/App/src/Middleware/ContentNegotiationMiddleware.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'RouteResult'
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

Check warning on line 11 in src/App/src/Middleware/ContentNegotiationMiddleware.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'ServerRequestInterface'
Expand All @@ -26,11 +26,12 @@ class ContentNegotiationMiddleware implements MiddlewareInterface
{
use ResponseTrait;

/**
* @Inject({"config.content-negotiation"})
*/
public function __construct(private array $config)
{
#[Inject(

Check warning on line 29 in src/App/src/Middleware/ContentNegotiationMiddleware.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Undefined class

Undefined class 'Inject'
"config.content-negotiation",
)]
public function __construct(
private array $config,

Check notice on line 33 in src/App/src/Middleware/ContentNegotiationMiddleware.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Property can be 'readonly'

Property can be 'readonly'
) {
}

public function process(
Expand Down
Loading

0 comments on commit ace75bc

Please sign in to comment.