Skip to content

Commit

Permalink
Update Rector config
Browse files Browse the repository at this point in the history
  • Loading branch information
phansys committed Aug 21, 2024
1 parent 614a540 commit ee91783
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 55 deletions.
4 changes: 3 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
])
->withPhpVersion(PhpVersion::PHP_74)
->withPhpSets()
->withConfiguredRule(TypedPropertyFromAssignsRector::class, [])
->withSkip([
TypedPropertyFromAssignsRector::class => [
__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
__DIR__.'/tests/Gedmo/Wrapper/Fixture/Entity/CompositeRelation.php', // @todo: remove this when https://github.com/doctrine/orm/issues/8255 is solved
__DIR__.'/tests/Gedmo/Blameable/Fixture/Entity/Company.php', // @todo: Remove this when fixing the configuration for the `Company::$created` property
__DIR__.'/tests/Gedmo/Wrapper/Fixture/Entity/CompositeRelation.php', // @todo: Remove this when https://github.com/doctrine/orm/issues/8255 is solved
],
])
->withImportNames(true, true, false)
Expand Down
4 changes: 1 addition & 3 deletions src/Sluggable/SluggableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ class SluggableListener extends MappedEventSubscriber
/**
* The power exponent to jump
* the slug unique number by tens.
*
* @var int
*/
private $exponent = 0;
private int $exponent = 0;

/**
* Transliteration callback for slugs
Expand Down
5 changes: 1 addition & 4 deletions src/SoftDeleteable/Query/TreeWalker/SoftDeleteableWalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ class SoftDeleteableWalker extends SqlWalker
*/
protected $meta;

/**
* @var QuoteStrategy
*/
private $quoteStrategy;
private QuoteStrategy $quoteStrategy;

public function __construct($query, $parserResult, array $queryComponents)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Tool/Logging/DBAL/QueryAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ class QueryAnalyzer implements SQLLogger
*
* @var string[]
*/
private $queries = [];
private array $queries = [];

/**
* Query execution times indexed
* in same order as queries
*
* @var float[]
*/
private $queryExecutionTimes = [];
private array $queryExecutionTimes = [];

/**
* Initialize log listener with database
Expand Down
4 changes: 1 addition & 3 deletions src/Translatable/Query/TreeWalker/TranslationWalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,8 @@ class TranslationWalker extends SqlWalker

/**
* DBAL database connection
*
* @var Connection
*/
private $conn;
private Connection $conn;

/**
* List of aliases to replace with translation
Expand Down
2 changes: 1 addition & 1 deletion src/Tree/Strategy/ORM/Closure.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Closure implements Strategy
*
* @phpstan-var array<int, array{node: object|Node, oldParent: mixed}>
*/
private $pendingNodeUpdates = [];
private array $pendingNodeUpdates = [];

/**
* List of pending Nodes, which needs their "level"
Expand Down
2 changes: 1 addition & 1 deletion src/Tree/Strategy/ORM/Nested.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Nested implements Strategy
*
* @var array<string, int>
*/
private $treeEdges = [];
private array $treeEdges = [];

/**
* Stores a list of node position strategies
Expand Down
4 changes: 2 additions & 2 deletions src/Uploadable/UploadableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class UploadableListener extends MappedEventSubscriber
*
* @var array<int, string>
*/
private $pendingFileRemovals = [];
private array $pendingFileRemovals = [];

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

public function __construct(?MimeTypeGuesserInterface $mimeTypeGuesser = null)
{
Expand Down
6 changes: 2 additions & 4 deletions tests/Gedmo/Blameable/Fixture/Entity/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ class Company implements Blameable
private $id;

/**
* @var string|null
*
* @ORM\Column(name="name", type="string", length=128)
*/
#[ORM\Column(name: 'name', type: Types::STRING, length: 128)]
private $name;
private ?string $name = null;

/**
* @var UuidV6|null
* @var UuidV6|string|null
*
* @Gedmo\Blameable(on="create")
*
Expand Down
12 changes: 3 additions & 9 deletions tests/Gedmo/Sluggable/Fixture/Issue100/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,15 @@ class Article implements Sluggable, Translatable
private $id;

/**
* @var string|null
*
* @Gedmo\Translatable
*
* @ORM\Column(name="title", type="string", length=64)
*/
#[ORM\Column(name: 'title', type: Types::STRING, length: 64)]
#[Gedmo\Translatable]
private $title;
private ?string $title = null;

/**
* @var string|null
*
* @Gedmo\Translatable
* @Gedmo\Slug(separator="-", updatable=true, fields={"title"}, unique=true, uniqueOverTranslations=true)
*
Expand All @@ -57,17 +53,15 @@ class Article implements Sluggable, Translatable
#[Gedmo\Translatable]
#[Gedmo\Slug(fields: ['title'], updatable: true, unique: true, uniqueOverTranslations: true, separator: '-')]
#[ORM\Column(name: 'slug', type: Types::STRING, length: 64, unique: true)]
private $slug;
private ?string $slug = null;

/**
* @var string|null
*
* @Gedmo\Locale
* Used locale to override Translation listener`s locale
* this is not a mapped field of entity metadata, just a simple property
*/
#[Gedmo\Locale]
private $locale;
private ?string $locale = null;

public function getId(): ?int
{
Expand Down
5 changes: 1 addition & 4 deletions tests/Gedmo/Sluggable/Issue/Issue100Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ final class Issue100Test extends BaseTestCaseORM
public const ARTICLE = Article::class;
public const TRANSLATION = Translation::class;

/**
* @var TranslatableListener
*/
private $translatableListener;
private TranslatableListener $translatableListener;

protected function setUp(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Gedmo\Tests\Translatable;

use Doctrine\Common\EventManager;
use Doctrine\ORM\EntityRepository;
use Gedmo\Tests\Tool\BaseTestCaseORM;
use Gedmo\Tests\Translatable\Fixture\Article;
use Gedmo\Translatable\Entity\Repository\TranslationRepository;
Expand All @@ -33,7 +34,7 @@ final class TranslatableEntityDefaultTranslationTest extends BaseTestCaseORM
/**
* @var TranslationRepository
*/
private $repo;
private EntityRepository $repo;

protected function setUp(): void
{
Expand Down
4 changes: 1 addition & 3 deletions tests/Gedmo/Tree/Fixture/Issue2616/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ class Category
private $id;

/**
* @var string|null
*
* @ORM\Column(name="title", type="string", length=64)
*/
#[ORM\Column(name: 'title', type: Types::STRING, length: 64)]
private $title;
private ?string $title = null;

/**
* @Gedmo\TreeLevel
Expand Down
4 changes: 1 addition & 3 deletions tests/Gedmo/Tree/Fixture/Issue2616/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ class Page
private $id;

/**
* @var string|null
*
* @ORM\Column(name="title", type="string", length=64)
*/
#[ORM\Column(name: 'title', type: Types::STRING, length: 64)]
private $title;
private ?string $title = null;

public function getId(): ?int
{
Expand Down
5 changes: 1 addition & 4 deletions tests/Gedmo/Tree/Issue/Issue2616Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@

class Issue2616Test extends BaseTestCaseORM
{
/**
* @var TreeListener
*/
private $listener;
private TreeListener $listener;

protected function setUp(): void
{
Expand Down
15 changes: 5 additions & 10 deletions tests/Gedmo/Uploadable/UploadableEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,15 @@ final class UploadableEntityTest extends BaseTestCaseORM

private UploadableListenerStub $listener;

/** @var string */
private $testFile;
private string $testFile;

/** @var string */
private $testFile2;
private string $testFile2;

/** @var string */
private $testFile3;
private string $testFile3;

/** @var string */
private $testFileWithoutExt;
private string $testFileWithoutExt;

/** @var string */
private $testFileWithSpaces;
private string $testFileWithSpaces;

private string $destinationTestDir;

Expand Down

0 comments on commit ee91783

Please sign in to comment.