Skip to content

Commit 63f1f2d

Browse files
Enable Rector PHP8.1 set
1 parent 00d26dc commit 63f1f2d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+56
-326
lines changed

rector.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010
$containerConfigurator
1111
->parameters()
1212
->set(Option::PATHS, [__DIR__ . '/src',])
13-
->set(Option::AUTO_IMPORT_NAMES, true);
13+
->set(Option::AUTO_IMPORT_NAMES, true)
14+
->set(Option::SKIP, [
15+
\Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class,
16+
]);
1417

1518
// Define what rule sets will be applied
19+
$containerConfigurator->import(\Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_81);
1620
$containerConfigurator->import(\Rector\Doctrine\Set\DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES);
1721
$containerConfigurator->import(\Rector\Symfony\Set\SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES);
1822

src/Command/CheckActionSecurityCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7474
if (!str_contains(strtolower($controller), 'app')) continue;
7575

7676
// Find actions. Possible formats: <service>:<action> and <namespace>:<bundle>:<action>. These need to be checked separately.
77-
$controllerArray = explode(':', $controller);
77+
$controllerArray = explode(':', (string)$controller);
7878
try {
7979
// Resolve service
8080
$controllerObject = $this->container->get($controllerArray[0]);
@@ -111,7 +111,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
111111
$error = [];
112112
// Concatenate non-pre-authorized methods
113113
$error[] = 'The following methods do not contain a Security or IsGranted annotation:';
114-
$error = array_merge($error, $noSecurity);
114+
$error = [...$error, ...$noSecurity];
115115

116116
// Feedback error
117117
$io->error(implode("\n", $error));

src/Database/EntityTraits/HasDefaultEntityTrait.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,12 @@ trait HasDefaultEntityTrait
2121
#[Serializer\Exclude]
2222
private $isDefault = false;
2323

24-
/**
25-
* @return bool
26-
*/
2724
public function isDefault(): bool
2825
{
2926
return $this->isDefault;
3027
}
3128

3229
/**
33-
* @param bool $isDefault
34-
*
3530
* @return $this
3631
*/
3732
public function setIsDefault(bool $isDefault): self

src/Database/EntityTraits/TimestampTrait.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,11 @@ trait TimestampTrait
2222
#[Serializer\Expose]
2323
private $timestamp;
2424

25-
/**
26-
* @return DateTimeInterface|null
27-
*/
2825
public function getTimestamp(): ?DateTimeInterface
2926
{
3027
return $this->timestamp;
3128
}
3229

33-
/**
34-
* @param DateTimeImmutable $timestamp
35-
*
36-
* @return TimestampTrait
37-
*/
3830
public function setTimestamp(DateTimeImmutable $timestamp): self
3931
{
4032
$this->timestamp = $timestamp;

src/Database/RepositoryTraits/FindBetweenTrait.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@ trait FindBetweenTrait
1717
* Find all entities between two given datetime instances.
1818
* If any is empty, it will not be used in the constraint
1919
*
20-
* @param DateTimeInterface|null $start
21-
* @param DateTimeInterface|null $end
22-
* @param string|null $alias If not given, 'e' will be used
23-
* @param bool $startInclusive If false, the compare will be exclusive
24-
* @param bool $endInclusive If false, the compare will be exclusive
20+
* @param string|null $alias If not given, 'e' will be used
21+
* @param bool $startInclusive If false, the compare will be exclusive
22+
* @param bool $endInclusive If false, the compare will be exclusive
2523
*
26-
* @return array
2724
*/
2825
public function findBetween(
2926
?DateTimeInterface $start,
@@ -41,13 +38,10 @@ public function findBetween(
4138
* Creates an query builder that will find all entities between two given datetime instances.
4239
* If any is empty, it will not be used in the constraint
4340
*
44-
* @param DateTimeInterface|null $start
45-
* @param DateTimeInterface|null $end
46-
* @param string|null $alias If not given, 'e' will be used
47-
* @param bool $startInclusive If false, the compare will be exclusive
48-
* @param bool $endInclusive If false, the compare will be exclusive
41+
* @param string|null $alias If not given, 'e' will be used
42+
* @param bool $startInclusive If false, the compare will be exclusive
43+
* @param bool $endInclusive If false, the compare will be exclusive
4944
*
50-
* @return QueryBuilder
5145
*/
5246
public function findBetweenQb(
5347
?DateTimeInterface $start,

src/Database/RepositoryTraits/FindIdsTrait.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ trait FindIdsTrait
1414
/**
1515
* Get the query builder to retrieve entities by the given ids
1616
*
17-
* @param array $ids
18-
* @param string|null $alias
1917
*
20-
* @return QueryBuilder
2118
*/
2219
public function findByIdsQb(array $ids, ?string $alias = NULL): QueryBuilder
2320
{
@@ -32,9 +29,7 @@ public function findByIdsQb(array $ids, ?string $alias = NULL): QueryBuilder
3229
/**
3330
* Retrieve entities by the given ids
3431
*
35-
* @param array $ids
3632
*
37-
* @return array
3833
*/
3934
public function findByIds(array $ids): array
4035
{

src/Database/RepositoryTraits/FindLastTrait.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ public function findLast()
2525
}
2626

2727
/**
28-
* @param int $amount
29-
*
3028
* @return mixed
3129
*/
3230
public function findLastX(int $amount)
@@ -35,12 +33,6 @@ public function findLastX(int $amount)
3533
->getQuery()->getResult();
3634
}
3735

38-
/**
39-
* @param int $amount
40-
* @param string $alias
41-
*
42-
* @return QueryBuilder
43-
*/
4436
public function findLastQb(int $amount = 1, string $alias = 'e'): QueryBuilder
4537
{
4638
return $this->createQueryBuilder($alias)

src/Database/RepositoryTraits/HasDefaultRepositoryTrait.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ public function getDefault()
2929
->setMaxResults(1)
3030
->getQuery()
3131
->getSingleResult();
32-
} catch (NoResultException $e) {
33-
return NULL;
34-
} catch (NonUniqueResultException $e) {
32+
} catch (NoResultException|NonUniqueResultException) {
3533
return NULL;
3634
}
3735
}

src/Database/RepositoryTraits/RowCountTrait.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ trait RowCountTrait
1313
{
1414
/**
1515
* Get the full table row count
16-
*
17-
* @return int
1816
*/
1917
public function getRowCount(): int
2018
{
@@ -24,10 +22,7 @@ public function getRowCount(): int
2422
/**
2523
* Retrieve the row count for the given builder and column
2624
*
27-
* @param QueryBuilder $queryBuilder
28-
* @param string $column
2925
*
30-
* @return int
3126
*
3227
* @noinspection PhpUnhandledExceptionInspection
3328
* @noinspection PhpDocMissingThrowsInspection

src/Database/Traits/Blameable.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,20 @@ trait Blameable
5555
*/
5656
public function getLastUpdated(): DateTimeInterface
5757
{
58-
return $this->getUpdatedAt() !== NULL ? $this->getUpdatedAt() : $this->getCreatedAt();
58+
return $this->getUpdatedAt() ?? $this->getCreatedAt();
5959
}
6060

6161
/**
6262
* Get the last updated by, which is either creation by or update by
6363
*/
6464
public function getLastUpdatedBy(): ?string
6565
{
66-
return $this->getUpdatedBy() !== NULL ? $this->getUpdatedBy() : $this->getCreatedBy();
66+
return $this->getUpdatedBy() ?? $this->getCreatedBy();
6767
}
6868

6969
/**
7070
* Set createdAt
7171
*
72-
* @param DateTimeImmutable $createdAt
7372
*
7473
* @return $this
7574
*/
@@ -82,8 +81,6 @@ public function setCreatedAt(DateTimeImmutable $createdAt): self
8281

8382
/**
8483
* Get createdAt
85-
*
86-
* @return DateTimeInterface|null
8784
*/
8885
public function getCreatedAt(): ?DateTimeInterface
8986
{
@@ -93,7 +90,6 @@ public function getCreatedAt(): ?DateTimeInterface
9390
/**
9491
* Set createdBy
9592
*
96-
* @param string|null $createdBy
9793
*
9894
* @return $this
9995
*/
@@ -106,8 +102,6 @@ public function setCreatedBy(?string $createdBy): self
106102

107103
/**
108104
* Get createdBy
109-
*
110-
* @return string|null
111105
*/
112106
public function getCreatedBy(): ?string
113107
{
@@ -117,7 +111,6 @@ public function getCreatedBy(): ?string
117111
/**
118112
* Set updatedAt
119113
*
120-
* @param DateTimeImmutable|null $updatedAt
121114
*
122115
* @return $this
123116
*/
@@ -130,8 +123,6 @@ public function setUpdatedAt(?DateTimeImmutable $updatedAt): self
130123

131124
/**
132125
* Get updatedAt
133-
*
134-
* @return DateTimeInterface|null
135126
*/
136127
public function getUpdatedAt(): ?DateTimeInterface
137128
{
@@ -141,7 +132,6 @@ public function getUpdatedAt(): ?DateTimeInterface
141132
/**
142133
* Set updatedBy
143134
*
144-
* @param string|null $updatedBy
145135
*
146136
* @return $this
147137
*/
@@ -154,8 +144,6 @@ public function setUpdatedBy(?string $updatedBy): self
154144

155145
/**
156146
* Get updatedBy
157-
*
158-
* @return string|null
159147
*/
160148
public function getUpdatedBy(): ?string
161149
{

src/Database/Traits/IdTrait.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ trait IdTrait
1818
#[Serializer\Expose]
1919
private $id;
2020

21-
/**
22-
* @return int|null
23-
*/
2421
public function getId(): ?int
2522
{
2623
return $this->id;

src/Database/Traits/SoftDeletable.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ trait SoftDeletable
2929
/**
3030
* Sets deletedAt.
3131
*
32-
* @param DateTimeImmutable|null $deletedAt
3332
*
3433
* @return $this
3534
*/
@@ -42,8 +41,6 @@ public function setDeletedAt(?DateTimeImmutable $deletedAt = NULL): self
4241

4342
/**
4443
* Returns deletedAt.
45-
*
46-
* @return DateTimeInterface|null
4744
*/
4845
public function getDeletedAt(): ?DateTimeInterface
4946
{
@@ -53,7 +50,6 @@ public function getDeletedAt(): ?DateTimeInterface
5350
/**
5451
* Set deletedBy
5552
*
56-
* @param string|null $deletedBy
5753
*
5854
* @return $this
5955
*/
@@ -66,8 +62,6 @@ public function setDeletedBy(?string $deletedBy): self
6662

6763
/**
6864
* Get deletedBy
69-
*
70-
* @return string|null
7165
*/
7266
public function getDeletedBy(): ?string
7367
{
@@ -76,8 +70,6 @@ public function getDeletedBy(): ?string
7670

7771
/**
7872
* Is deleted?
79-
*
80-
* @return bool
8173
*/
8274
public function isDeleted(): bool
8375
{

src/Database/Types/AbstractJmsType.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
abstract class AbstractJmsType extends JsonType
1212
{
1313
/**
14-
* @param mixed $value
15-
* @param AbstractPlatform $platform
14+
* @param mixed $value
1615
*
1716
* @return false|mixed|string|null
1817
* @throws ConversionException
@@ -36,8 +35,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform)
3635
}
3736

3837
/**
39-
* @param mixed $value
40-
* @param AbstractPlatform $platform
38+
* @param mixed $value
4139
*
4240
* @return mixed|null
4341
* @throws ConversionException
@@ -52,15 +50,13 @@ public function convertToPHPValue($value, AbstractPlatform $platform)
5250

5351
try {
5452
return StaticSerializer::getSerializer()->deserialize($value, $this->getJmsType(), 'json');
55-
} catch (Exception $e) {
53+
} catch (Exception) {
5654
throw ConversionException::conversionFailed($value, $this->getName());
5755
}
5856
}
5957

6058
/**
6159
* Overwrite this to enable serialization group support
62-
*
63-
* @return array|null
6460
*/
6561
protected function getSerializationGroups(): ?array
6662
{

src/Database/Types/DateTimeImmutableWithConversionType.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313
*/
1414
class DateTimeImmutableWithConversionType extends DateTimeImmutableType
1515
{
16-
public const DATETIME_IMMUTABLE_WITH_CONVERSION = 'datetime_immutable_with_conversion';
16+
public final const DATETIME_IMMUTABLE_WITH_CONVERSION = 'datetime_immutable_with_conversion';
1717

1818
/**
19-
* @param mixed $value
20-
* @param AbstractPlatform $platform
19+
* @param mixed $value
2120
*
2221
* @return mixed|string|null
2322
* @throws ConversionException

src/Database/Types/UTCDateImmutableType.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
class UTCDateImmutableType extends DateImmutableType
1313
{
1414
/**
15-
* @param mixed $value
16-
* @param AbstractPlatform $platform
15+
* @param mixed $value
1716
*
1817
* @return mixed|string|null
1918
* @throws Exception
@@ -28,8 +27,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform)
2827
}
2928

3029
/**
31-
* @param mixed $value
32-
* @param AbstractPlatform $platform
30+
* @param mixed $value
3331
*
3432
* @return DateTimeImmutable|null
3533
* @throws Exception

0 commit comments

Comments
 (0)