Skip to content

Commit ee91783

Browse files
committed
Update Rector config
1 parent 614a540 commit ee91783

File tree

16 files changed

+28
-55
lines changed

16 files changed

+28
-55
lines changed

rector.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
])
2222
->withPhpVersion(PhpVersion::PHP_74)
2323
->withPhpSets()
24+
->withConfiguredRule(TypedPropertyFromAssignsRector::class, [])
2425
->withSkip([
2526
TypedPropertyFromAssignsRector::class => [
2627
__DIR__.'/src/Mapping/MappedEventSubscriber.php', // Rector is trying to set a type on the $annotationReader property which requires a union type, not supported on PHP 7.4
27-
__DIR__.'/tests/Gedmo/Wrapper/Fixture/Entity/CompositeRelation.php', // @todo: remove this when https://github.com/doctrine/orm/issues/8255 is solved
28+
__DIR__.'/tests/Gedmo/Blameable/Fixture/Entity/Company.php', // @todo: Remove this when fixing the configuration for the `Company::$created` property
29+
__DIR__.'/tests/Gedmo/Wrapper/Fixture/Entity/CompositeRelation.php', // @todo: Remove this when https://github.com/doctrine/orm/issues/8255 is solved
2830
],
2931
])
3032
->withImportNames(true, true, false)

src/Sluggable/SluggableListener.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ class SluggableListener extends MappedEventSubscriber
7474
/**
7575
* The power exponent to jump
7676
* the slug unique number by tens.
77-
*
78-
* @var int
7977
*/
80-
private $exponent = 0;
78+
private int $exponent = 0;
8179

8280
/**
8381
* Transliteration callback for slugs

src/SoftDeleteable/Query/TreeWalker/SoftDeleteableWalker.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ class SoftDeleteableWalker extends SqlWalker
8181
*/
8282
protected $meta;
8383

84-
/**
85-
* @var QuoteStrategy
86-
*/
87-
private $quoteStrategy;
84+
private QuoteStrategy $quoteStrategy;
8885

8986
public function __construct($query, $parserResult, array $queryComponents)
9087
{

src/Tool/Logging/DBAL/QueryAnalyzer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ class QueryAnalyzer implements SQLLogger
4646
*
4747
* @var string[]
4848
*/
49-
private $queries = [];
49+
private array $queries = [];
5050

5151
/**
5252
* Query execution times indexed
5353
* in same order as queries
5454
*
5555
* @var float[]
5656
*/
57-
private $queryExecutionTimes = [];
57+
private array $queryExecutionTimes = [];
5858

5959
/**
6060
* Initialize log listener with database

src/Translatable/Query/TreeWalker/TranslationWalker.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,8 @@ class TranslationWalker extends SqlWalker
9797

9898
/**
9999
* DBAL database connection
100-
*
101-
* @var Connection
102100
*/
103-
private $conn;
101+
private Connection $conn;
104102

105103
/**
106104
* List of aliases to replace with translation

src/Tree/Strategy/ORM/Closure.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Closure implements Strategy
6464
*
6565
* @phpstan-var array<int, array{node: object|Node, oldParent: mixed}>
6666
*/
67-
private $pendingNodeUpdates = [];
67+
private array $pendingNodeUpdates = [];
6868

6969
/**
7070
* List of pending Nodes, which needs their "level"

src/Tree/Strategy/ORM/Nested.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Nested implements Strategy
7575
*
7676
* @var array<string, int>
7777
*/
78-
private $treeEdges = [];
78+
private array $treeEdges = [];
7979

8080
/**
8181
* Stores a list of node position strategies

src/Uploadable/UploadableListener.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class UploadableListener extends MappedEventSubscriber
7676
*
7777
* @var array<int, string>
7878
*/
79-
private $pendingFileRemovals = [];
79+
private array $pendingFileRemovals = [];
8080

8181
/**
8282
* Array of FileInfoInterface objects. The index is the hash of the entity owner
@@ -86,7 +86,7 @@ class UploadableListener extends MappedEventSubscriber
8686
*
8787
* @phpstan-var array<int, array{entity: object, fileInfo: FileInfoInterface}>
8888
*/
89-
private $fileInfoObjects = [];
89+
private array $fileInfoObjects = [];
9090

9191
public function __construct(?MimeTypeGuesserInterface $mimeTypeGuesser = null)
9292
{

tests/Gedmo/Blameable/Fixture/Entity/Company.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@ class Company implements Blameable
3737
private $id;
3838

3939
/**
40-
* @var string|null
41-
*
4240
* @ORM\Column(name="name", type="string", length=128)
4341
*/
4442
#[ORM\Column(name: 'name', type: Types::STRING, length: 128)]
45-
private $name;
43+
private ?string $name = null;
4644

4745
/**
48-
* @var UuidV6|null
46+
* @var UuidV6|string|null
4947
*
5048
* @Gedmo\Blameable(on="create")
5149
*

tests/Gedmo/Sluggable/Fixture/Issue100/Article.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,15 @@ class Article implements Sluggable, Translatable
3636
private $id;
3737

3838
/**
39-
* @var string|null
40-
*
4139
* @Gedmo\Translatable
4240
*
4341
* @ORM\Column(name="title", type="string", length=64)
4442
*/
4543
#[ORM\Column(name: 'title', type: Types::STRING, length: 64)]
4644
#[Gedmo\Translatable]
47-
private $title;
45+
private ?string $title = null;
4846

4947
/**
50-
* @var string|null
51-
*
5248
* @Gedmo\Translatable
5349
* @Gedmo\Slug(separator="-", updatable=true, fields={"title"}, unique=true, uniqueOverTranslations=true)
5450
*
@@ -57,17 +53,15 @@ class Article implements Sluggable, Translatable
5753
#[Gedmo\Translatable]
5854
#[Gedmo\Slug(fields: ['title'], updatable: true, unique: true, uniqueOverTranslations: true, separator: '-')]
5955
#[ORM\Column(name: 'slug', type: Types::STRING, length: 64, unique: true)]
60-
private $slug;
56+
private ?string $slug = null;
6157

6258
/**
63-
* @var string|null
64-
*
6559
* @Gedmo\Locale
6660
* Used locale to override Translation listener`s locale
6761
* this is not a mapped field of entity metadata, just a simple property
6862
*/
6963
#[Gedmo\Locale]
70-
private $locale;
64+
private ?string $locale = null;
7165

7266
public function getId(): ?int
7367
{

tests/Gedmo/Sluggable/Issue/Issue100Test.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ final class Issue100Test extends BaseTestCaseORM
2828
public const ARTICLE = Article::class;
2929
public const TRANSLATION = Translation::class;
3030

31-
/**
32-
* @var TranslatableListener
33-
*/
34-
private $translatableListener;
31+
private TranslatableListener $translatableListener;
3532

3633
protected function setUp(): void
3734
{

tests/Gedmo/Translatable/TranslatableEntityDefaultTranslationTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Gedmo\Tests\Translatable;
1313

1414
use Doctrine\Common\EventManager;
15+
use Doctrine\ORM\EntityRepository;
1516
use Gedmo\Tests\Tool\BaseTestCaseORM;
1617
use Gedmo\Tests\Translatable\Fixture\Article;
1718
use Gedmo\Translatable\Entity\Repository\TranslationRepository;
@@ -33,7 +34,7 @@ final class TranslatableEntityDefaultTranslationTest extends BaseTestCaseORM
3334
/**
3435
* @var TranslationRepository
3536
*/
36-
private $repo;
37+
private EntityRepository $repo;
3738

3839
protected function setUp(): void
3940
{

tests/Gedmo/Tree/Fixture/Issue2616/Category.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,10 @@ class Category
6868
private $id;
6969

7070
/**
71-
* @var string|null
72-
*
7371
* @ORM\Column(name="title", type="string", length=64)
7472
*/
7573
#[ORM\Column(name: 'title', type: Types::STRING, length: 64)]
76-
private $title;
74+
private ?string $title = null;
7775

7876
/**
7977
* @Gedmo\TreeLevel

tests/Gedmo/Tree/Fixture/Issue2616/Page.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ class Page
4141
private $id;
4242

4343
/**
44-
* @var string|null
45-
*
4644
* @ORM\Column(name="title", type="string", length=64)
4745
*/
4846
#[ORM\Column(name: 'title', type: Types::STRING, length: 64)]
49-
private $title;
47+
private ?string $title = null;
5048

5149
public function getId(): ?int
5250
{

tests/Gedmo/Tree/Issue/Issue2616Test.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717

1818
class Issue2616Test extends BaseTestCaseORM
1919
{
20-
/**
21-
* @var TreeListener
22-
*/
23-
private $listener;
20+
private TreeListener $listener;
2421

2522
protected function setUp(): void
2623
{

tests/Gedmo/Uploadable/UploadableEntityTest.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,15 @@ final class UploadableEntityTest extends BaseTestCaseORM
7070

7171
private UploadableListenerStub $listener;
7272

73-
/** @var string */
74-
private $testFile;
73+
private string $testFile;
7574

76-
/** @var string */
77-
private $testFile2;
75+
private string $testFile2;
7876

79-
/** @var string */
80-
private $testFile3;
77+
private string $testFile3;
8178

82-
/** @var string */
83-
private $testFileWithoutExt;
79+
private string $testFileWithoutExt;
8480

85-
/** @var string */
86-
private $testFileWithSpaces;
81+
private string $testFileWithSpaces;
8782

8883
private string $destinationTestDir;
8984

0 commit comments

Comments
 (0)