Skip to content

Commit 4b1e3a0

Browse files
committed
Fixed repository service method variable type issues
1 parent 2ec6ad2 commit 4b1e3a0

11 files changed

+24
-22
lines changed

src/Repository/ApiKeyRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace App\Repository;
1010

1111
use App\Entity\ApiKey as Entity;
12+
use Doctrine\DBAL\LockMode;
1213
use Doctrine\Persistence\ManagerRegistry;
1314

1415
/**
@@ -18,7 +19,7 @@
1819
* @psalm-suppress LessSpecificImplementedReturnType
1920
* @codingStandardsIgnoreStart
2021
*
21-
* @method Entity|null find(string $id, ?int $lockMode = null, ?int $lockVersion = null)
22+
* @method Entity|null find(string $id, LockMode|int|null $lockMode = null, ?int $lockVersion = null)
2223
* @method Entity|null findAdvanced(string $id, string | int | null $hydrationMode = null)
2324
* @method Entity|null findOneBy(array $criteria, ?array $orderBy = null)
2425
* @method Entity[] findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null)

src/Repository/DateDimensionRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace App\Repository;
1010

1111
use App\Entity\DateDimension as Entity;
12+
use Doctrine\DBAL\LockMode;
1213
use Doctrine\Persistence\ManagerRegistry;
1314

1415
/**
@@ -18,7 +19,7 @@
1819
* @psalm-suppress LessSpecificImplementedReturnType
1920
* @codingStandardsIgnoreStart
2021
*
21-
* @method Entity|null find(string $id, ?int $lockMode = null, ?int $lockVersion = null)
22+
* @method Entity|null find(string $id, LockMode|int|null $lockMode = null, ?int $lockVersion = null)
2223
* @method Entity|null findAdvanced(string $id, string | int | null $hydrationMode = null)
2324
* @method Entity|null findOneBy(array $criteria, ?array $orderBy = null)
2425
* @method Entity[] findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null)

src/Repository/HealthzRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use DateInterval;
1313
use DateTimeImmutable;
1414
use DateTimeZone;
15+
use Doctrine\DBAL\LockMode;
1516
use Doctrine\DBAL\Types\Types;
1617
use Doctrine\ORM\NonUniqueResultException;
1718
use Doctrine\Persistence\ManagerRegistry;
@@ -25,7 +26,7 @@
2526
* @psalm-suppress LessSpecificImplementedReturnType
2627
* @codingStandardsIgnoreStart
2728
*
28-
* @method Entity|null find(string $id, ?int $lockMode = null, ?int $lockVersion = null)
29+
* @method Entity|null find(string $id, LockMode|int|null $lockMode = null, ?int $lockVersion = null)
2930
* @method Entity|null findAdvanced(string $id, string | int | null $hydrationMode = null)
3031
* @method Entity|null findOneBy(array $criteria, ?array $orderBy = null)
3132
* @method Entity[] findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null)

src/Repository/Interfaces/BaseRepositoryInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,11 @@ public function createQueryBuilder(?string $alias = null, ?string $indexBy = nul
7373
/**
7474
* Wrapper for default Doctrine repository find method.
7575
*
76-
* @psalm-param LockMode::*|null $lockMode
77-
*
7876
* @throws ORMException
7977
* @throws OptimisticLockException
8078
* @throws TransactionRequiredException
8179
*/
82-
public function find(string $id, ?int $lockMode = null, ?int $lockVersion = null): ?EntityInterface;
80+
public function find(string $id, LockMode|int|null $lockMode = null, ?int $lockVersion = null): ?EntityInterface;
8381

8482
/**
8583
* Advanced version of find method, with this you can process query as you

src/Repository/LogLoginFailureRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use App\Entity\LogLoginFailure as Entity;
1212
use App\Entity\User;
13+
use Doctrine\DBAL\LockMode;
1314
use Doctrine\Persistence\ManagerRegistry;
1415
use Ramsey\Uuid\Doctrine\UuidBinaryOrderedTimeType;
1516

@@ -20,7 +21,7 @@
2021
* @psalm-suppress LessSpecificImplementedReturnType
2122
* @codingStandardsIgnoreStart
2223
*
23-
* @method Entity|null find(string $id, ?int $lockMode = null, ?int $lockVersion = null)
24+
* @method Entity|null find(string $id, LockMode|int|null $lockMode = null, ?int $lockVersion = null)
2425
* @method Entity|null findAdvanced(string $id, string | int | null $hydrationMode = null)
2526
* @method Entity|null findOneBy(array $criteria, ?array $orderBy = null)
2627
* @method Entity[] findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null)

src/Repository/LogLoginRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace App\Repository;
1010

1111
use App\Entity\LogLogin as Entity;
12+
use Doctrine\DBAL\LockMode;
1213
use Doctrine\Persistence\ManagerRegistry;
1314

1415
/**
@@ -18,7 +19,7 @@
1819
* @psalm-suppress LessSpecificImplementedReturnType
1920
* @codingStandardsIgnoreStart
2021
*
21-
* @method Entity|null find(string $id, ?int $lockMode = null, ?int $lockVersion = null)
22+
* @method Entity|null find(string $id, LockMode|int|null $lockMode = null, ?int $lockVersion = null)
2223
* @method Entity|null findAdvanced(string $id, string | int | null $hydrationMode = null)
2324
* @method Entity|null findOneBy(array $criteria, ?array $orderBy = null)
2425
* @method Entity[] findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null)

src/Repository/LogRequestRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use DateInterval;
1313
use DateTimeImmutable;
1414
use DateTimeZone;
15+
use Doctrine\DBAL\LockMode;
1516
use Doctrine\Persistence\ManagerRegistry;
1617
use Exception;
1718

@@ -22,7 +23,7 @@
2223
* @psalm-suppress LessSpecificImplementedReturnType
2324
* @codingStandardsIgnoreStart
2425
*
25-
* @method Entity|null find(string $id, ?int $lockMode = null, ?int $lockVersion = null)
26+
* @method Entity|null find(string $id, LockMode|int|null $lockMode = null, ?int $lockVersion = null)
2627
* @method Entity|null findAdvanced(string $id, string | int | null $hydrationMode = null)
2728
* @method Entity|null findOneBy(array $criteria, ?array $orderBy = null)
2829
* @method Entity[] findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null)

src/Repository/RoleRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace App\Repository;
1010

1111
use App\Entity\Role as Entity;
12+
use Doctrine\DBAL\LockMode;
1213
use Doctrine\Persistence\ManagerRegistry;
1314

1415
/**
@@ -18,7 +19,7 @@
1819
* @psalm-suppress LessSpecificImplementedReturnType
1920
* @codingStandardsIgnoreStart
2021
*
21-
* @method Entity|null find(string $id, ?int $lockMode = null, ?int $lockVersion = null)
22+
* @method Entity|null find(string $id, LockMode|int|null $lockMode = null, ?int $lockVersion = null)
2223
* @method Entity|null findAdvanced(string $id, string | int | null $hydrationMode = null)
2324
* @method Entity|null findOneBy(array $criteria, ?array $orderBy = null)
2425
* @method Entity[] findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null)

src/Repository/Traits/RepositoryMethodsTrait.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626
*/
2727
trait RepositoryMethodsTrait
2828
{
29-
/**
30-
* @psalm-param LockMode::*|null $lockMode
31-
*/
32-
public function find(string $id, ?int $lockMode = null, ?int $lockVersion = null): ?EntityInterface
29+
public function find(string $id, LockMode|int|null $lockMode = null, ?int $lockVersion = null): ?EntityInterface
3330
{
3431
$output = $this->getEntityManager()->find($this->getEntityName(), $id, $lockMode, $lockVersion);
3532

@@ -39,7 +36,7 @@ public function find(string $id, ?int $lockMode = null, ?int $lockVersion = null
3936
/**
4037
* @psalm-param string|AbstractQuery::HYDRATE_*|null $hydrationMode
4138
*/
42-
public function findAdvanced(string $id, string | int | null $hydrationMode = null): null | array | EntityInterface
39+
public function findAdvanced(string $id, string|int|null $hydrationMode = null): null | array | EntityInterface
4340
{
4441
// Get query builder
4542
$queryBuilder = $this->getQueryBuilder();
@@ -62,9 +59,7 @@ public function findAdvanced(string $id, string | int | null $hydrationMode = nu
6259

6360
public function findOneBy(array $criteria, ?array $orderBy = null): ?object
6461
{
65-
$repository = $this->getEntityManager()->getRepository($this->getEntityName());
66-
67-
return $repository->findOneBy($criteria, $orderBy);
62+
return $this->getEntityManager()->getRepository($this->getEntityName())->findOneBy($criteria, $orderBy);
6863
}
6964

7065
/**
@@ -90,7 +85,7 @@ public function findByAdvanced(
9085
?array $orderBy = null,
9186
?int $limit = null,
9287
?int $offset = null,
93-
?array $search = null
88+
?array $search = null,
9489
): array {
9590
// Get query builder
9691
$queryBuilder = $this->getQueryBuilder($criteria, $search, $orderBy, $limit, $offset);
@@ -200,7 +195,7 @@ private function getQueryBuilder(
200195
?array $search = null,
201196
?array $orderBy = null,
202197
?int $limit = null,
203-
?int $offset = null
198+
?int $offset = null,
204199
): QueryBuilder {
205200
// Create new QueryBuilder for this instance
206201
$queryBuilder = $this->createQueryBuilder();

src/Repository/UserGroupRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace App\Repository;
1010

1111
use App\Entity\UserGroup as Entity;
12+
use Doctrine\DBAL\LockMode;
1213
use Doctrine\Persistence\ManagerRegistry;
1314

1415
/**
@@ -18,7 +19,7 @@
1819
* @psalm-suppress LessSpecificImplementedReturnType
1920
* @codingStandardsIgnoreStart
2021
*
21-
* @method Entity|null find(string $id, ?int $lockMode = null, ?int $lockVersion = null)
22+
* @method Entity|null find(string $id, LockMode|int|null $lockMode = null, ?int $lockVersion = null)
2223
* @method Entity|null findAdvanced(string $id, string | int | null $hydrationMode = null)
2324
* @method Entity|null findOneBy(array $criteria, ?array $orderBy = null)
2425
* @method Entity[] findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null)

0 commit comments

Comments
 (0)