diff --git a/APM/CommandLoggerRegistry.php b/APM/CommandLoggerRegistry.php index 1b6bfcd8..5d896db7 100644 --- a/APM/CommandLoggerRegistry.php +++ b/APM/CommandLoggerRegistry.php @@ -11,7 +11,7 @@ final class CommandLoggerRegistry { /** @var CommandLoggerInterface[] */ - private $commandLoggers = []; + private array $commandLoggers = []; public function __construct(iterable $commandLoggers) { diff --git a/APM/PSRCommandLogger.php b/APM/PSRCommandLogger.php index 20a4e07a..3ce15f08 100644 --- a/APM/PSRCommandLogger.php +++ b/APM/PSRCommandLogger.php @@ -16,14 +16,11 @@ final class PSRCommandLogger implements CommandLoggerInterface { - /** @var bool */ - private $registered = false; + private bool $registered = false; - /** @var LoggerInterface|null */ - private $logger; + private ?LoggerInterface $logger; - /** @var string */ - private $prefix; + private string $prefix; public function __construct(?LoggerInterface $logger, string $prefix = 'MongoDB command: ') { diff --git a/APM/StopwatchCommandLogger.php b/APM/StopwatchCommandLogger.php index ffe1619b..a5121b42 100644 --- a/APM/StopwatchCommandLogger.php +++ b/APM/StopwatchCommandLogger.php @@ -16,11 +16,9 @@ final class StopwatchCommandLogger implements CommandLoggerInterface { - /** @var bool */ - private $registered = false; + private bool $registered = false; - /** @var Stopwatch|null */ - private $stopwatch; + private ?Stopwatch $stopwatch; public function __construct(?Stopwatch $stopwatch) { diff --git a/CacheWarmer/HydratorCacheWarmer.php b/CacheWarmer/HydratorCacheWarmer.php index 17fea048..af6c7f73 100644 --- a/CacheWarmer/HydratorCacheWarmer.php +++ b/CacheWarmer/HydratorCacheWarmer.php @@ -31,8 +31,7 @@ */ class HydratorCacheWarmer implements CacheWarmerInterface { - /** @var ContainerInterface */ - private $container; + private ContainerInterface $container; public function __construct(ContainerInterface $container) { diff --git a/CacheWarmer/PersistentCollectionCacheWarmer.php b/CacheWarmer/PersistentCollectionCacheWarmer.php index ef28c30b..9d08be70 100644 --- a/CacheWarmer/PersistentCollectionCacheWarmer.php +++ b/CacheWarmer/PersistentCollectionCacheWarmer.php @@ -32,8 +32,7 @@ */ class PersistentCollectionCacheWarmer implements CacheWarmerInterface { - /** @var ContainerInterface */ - private $container; + private ContainerInterface $container; public function __construct(ContainerInterface $container) { diff --git a/CacheWarmer/ProxyCacheWarmer.php b/CacheWarmer/ProxyCacheWarmer.php index dde971dd..443a634d 100644 --- a/CacheWarmer/ProxyCacheWarmer.php +++ b/CacheWarmer/ProxyCacheWarmer.php @@ -33,8 +33,7 @@ */ class ProxyCacheWarmer implements CacheWarmerInterface { - /** @var ContainerInterface */ - private $container; + private ContainerInterface $container; public function __construct(ContainerInterface $container) { diff --git a/Command/DoctrineODMCommand.php b/Command/DoctrineODMCommand.php index d4600b44..ba40f2bf 100644 --- a/Command/DoctrineODMCommand.php +++ b/Command/DoctrineODMCommand.php @@ -33,8 +33,7 @@ abstract class DoctrineODMCommand extends Command /** @var ContainerInterface|null */ protected $container; - /** @var ManagerRegistry|null */ - private $managerRegistry; + private ?ManagerRegistry $managerRegistry; public function __construct(?ManagerRegistry $registry = null) { diff --git a/Command/LoadDataFixturesDoctrineODMCommand.php b/Command/LoadDataFixturesDoctrineODMCommand.php index 4fd79de5..568f1c32 100644 --- a/Command/LoadDataFixturesDoctrineODMCommand.php +++ b/Command/LoadDataFixturesDoctrineODMCommand.php @@ -27,8 +27,7 @@ */ class LoadDataFixturesDoctrineODMCommand extends DoctrineODMCommand { - /** @var SymfonyFixturesLoaderInterface */ - private $fixturesLoader; + private ?SymfonyFixturesLoaderInterface $fixturesLoader; public function __construct(?ManagerRegistry $registry = null, ?KernelInterface $kernel = null, ?SymfonyFixturesLoaderInterface $fixturesLoader = null) { diff --git a/DataCollector/CommandDataCollector.php b/DataCollector/CommandDataCollector.php index 145557ec..88529c48 100644 --- a/DataCollector/CommandDataCollector.php +++ b/DataCollector/CommandDataCollector.php @@ -21,8 +21,7 @@ class CommandDataCollector extends DataCollector { - /** @var CommandLogger */ - private $commandLogger; + private CommandLogger $commandLogger; public function __construct(CommandLogger $commandLogger) { diff --git a/Form/ChoiceList/MongoDBQueryBuilderLoader.php b/Form/ChoiceList/MongoDBQueryBuilderLoader.php index 918e4954..31d59d14 100644 --- a/Form/ChoiceList/MongoDBQueryBuilderLoader.php +++ b/Form/ChoiceList/MongoDBQueryBuilderLoader.php @@ -22,10 +22,8 @@ class MongoDBQueryBuilderLoader implements EntityLoaderInterface * entities * * This property should only be accessed through queryBuilder. - * - * @var Builder */ - private $queryBuilder; + private Builder $queryBuilder; /** * Construct an ORM Query Builder Loader diff --git a/Form/DoctrineMongoDBTypeGuesser.php b/Form/DoctrineMongoDBTypeGuesser.php index 54358550..f10eb37a 100644 --- a/Form/DoctrineMongoDBTypeGuesser.php +++ b/Form/DoctrineMongoDBTypeGuesser.php @@ -30,8 +30,8 @@ class DoctrineMongoDBTypeGuesser implements FormTypeGuesserInterface /** @var ManagerRegistry */ protected $registry; - /** @var array */ - private $cache = []; + /** @var array */ + private array $cache = []; public function __construct(ManagerRegistry $registry) { diff --git a/Loader/SymfonyFixturesLoader.php b/Loader/SymfonyFixturesLoader.php index 8d7494d0..45d1ef04 100644 --- a/Loader/SymfonyFixturesLoader.php +++ b/Loader/SymfonyFixturesLoader.php @@ -21,10 +21,10 @@ final class SymfonyFixturesLoader extends ContainerAwareLoader implements SymfonyFixturesLoaderInterface { /** @var FixtureInterface[] */ - private $loadedFixtures = []; + private array $loadedFixtures = []; /** @var array> */ - private $groupsFixtureMapping = []; + private array $groupsFixtureMapping = []; /** * @internal diff --git a/ManagerConfigurator.php b/ManagerConfigurator.php index a338929c..77ab2add 100644 --- a/ManagerConfigurator.php +++ b/ManagerConfigurator.php @@ -14,7 +14,7 @@ class ManagerConfigurator { /** @var array */ - private $enabledFilters = []; + private array $enabledFilters = []; /** * Construct. diff --git a/Repository/ContainerRepositoryFactory.php b/Repository/ContainerRepositoryFactory.php index c4bbc7e4..4d9a7a92 100644 --- a/Repository/ContainerRepositoryFactory.php +++ b/Repository/ContainerRepositoryFactory.php @@ -25,10 +25,9 @@ final class ContainerRepositoryFactory implements RepositoryFactory { /** @var array */ - private $managedRepositories = []; + private array $managedRepositories = []; - /** @var ContainerInterface|null */ - private $container; + private ContainerInterface $container; /** @param ContainerInterface $container A service locator containing the repositories */ public function __construct(ContainerInterface $container) @@ -50,7 +49,7 @@ public function getRepository(DocumentManager $documentManager, string $document if ($customRepositoryName !== null) { // fetch from the container - if ($this->container && $this->container->has($customRepositoryName)) { + if ($this->container->has($customRepositoryName)) { /** @var ObjectRepository $repository */ $repository = $this->container->get($customRepositoryName); diff --git a/Tests/APM/StopwatchCommandLoggerTest.php b/Tests/APM/StopwatchCommandLoggerTest.php index 55912812..48907bca 100644 --- a/Tests/APM/StopwatchCommandLoggerTest.php +++ b/Tests/APM/StopwatchCommandLoggerTest.php @@ -10,16 +10,11 @@ use Doctrine\ODM\MongoDB\DocumentManager; use Symfony\Component\Stopwatch\Stopwatch; -use function method_exists; - class StopwatchCommandLoggerTest extends TestCase { - /** @var StopwatchCommandLogger */ - private $commandLogger; - /** @var Stopwatch */ - private $stopwatch; - /** @var DocumentManager */ - private $dm; + private StopwatchCommandLogger $commandLogger; + private Stopwatch $stopwatch; + private DocumentManager $dm; protected function setUp(): void { @@ -57,13 +52,7 @@ public function testItLogsStopwatchEvents(): void self::assertCount(3, $events); foreach ($events as $eventName => $stopwatchEvent) { - // @todo replace with assertMatchesRegularExpression() when PHP 7.2 is dropped - if (method_exists($this, 'assertMatchesRegularExpression')) { - self::assertMatchesRegularExpression('/mongodb_\d+/', $eventName); - } else { - self::assertRegExp('/mongodb_\d+/', $eventName); - } - + self::assertMatchesRegularExpression('/mongodb_\d+/', $eventName); self::assertGreaterThan(0, $stopwatchEvent->getDuration()); self::assertSame('doctrine_mongodb', $stopwatchEvent->getCategory()); } diff --git a/Tests/CacheWarmer/HydratorCacheWarmerTest.php b/Tests/CacheWarmer/HydratorCacheWarmerTest.php index ca46170c..9c3a0552 100644 --- a/Tests/CacheWarmer/HydratorCacheWarmerTest.php +++ b/Tests/CacheWarmer/HydratorCacheWarmerTest.php @@ -11,7 +11,6 @@ use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ContainerInterface; -use function method_exists; use function sys_get_temp_dir; use function unlink; @@ -19,11 +18,9 @@ class HydratorCacheWarmerTest extends TestCase { - /** @var ContainerInterface */ - private $container; + private ContainerInterface $container; - /** @var HydratorCacheWarmer */ - private $warmer; + private HydratorCacheWarmer $warmer; protected function setUp(): void { @@ -65,24 +62,12 @@ public function testWarmerNotExecuted(int $autoGenerate): void try { $this->warmer->warmUp('meh'); - // Replace by "assertFileDoesNotExist" when PHPUnit 9 is minimum - $this->assertFileDoesNotExistWithBC($hydratorFilename); + $this->assertFileDoesNotExist($hydratorFilename); } finally { @unlink($hydratorFilename); } } - private function assertFileDoesNotExistWithBC(string $filename): void - { - if (! method_exists($this, 'assertFileDoesNotExist')) { - $this->assertFileNotExists($filename); - - return; - } - - $this->assertFileDoesNotExist($filename); - } - /** @return array */ public function provideWarmerNotExecuted(): array { diff --git a/Tests/CacheWarmer/PersistentCollectionCacheWarmerTest.php b/Tests/CacheWarmer/PersistentCollectionCacheWarmerTest.php index 77c1a248..03efcc9c 100644 --- a/Tests/CacheWarmer/PersistentCollectionCacheWarmerTest.php +++ b/Tests/CacheWarmer/PersistentCollectionCacheWarmerTest.php @@ -17,14 +17,12 @@ class PersistentCollectionCacheWarmerTest extends TestCase { - /** @var ContainerInterface */ - private $container; + private ContainerInterface $container; /** @var PersistentCollectionGenerator&MockObject */ - private $generatorMock; + private PersistentCollectionGenerator $generatorMock; - /** @var PersistentCollectionCacheWarmer */ - private $warmer; + private PersistentCollectionCacheWarmer $warmer; protected function setUp(): void { diff --git a/Tests/CacheWarmer/ProxyCacheWarmerTest.php b/Tests/CacheWarmer/ProxyCacheWarmerTest.php index 1e9fbc67..34979d7d 100644 --- a/Tests/CacheWarmer/ProxyCacheWarmerTest.php +++ b/Tests/CacheWarmer/ProxyCacheWarmerTest.php @@ -18,14 +18,12 @@ class ProxyCacheWarmerTest extends TestCase { - /** @var ContainerInterface */ - private $container; + private ContainerInterface $container; - /** @var ProxyFactory|MockObject */ - private $proxyMock; + /** @var ProxyFactory&MockObject */ + private ProxyFactory $proxyMock; - /** @var ProxyCacheWarmer */ - private $warmer; + private ProxyCacheWarmer $warmer; protected function setUp(): void { diff --git a/Tests/Command/LoadDataFixturesDoctrineODMCommandTest.php b/Tests/Command/LoadDataFixturesDoctrineODMCommandTest.php index 2724d48b..e4552a42 100644 --- a/Tests/Command/LoadDataFixturesDoctrineODMCommandTest.php +++ b/Tests/Command/LoadDataFixturesDoctrineODMCommandTest.php @@ -11,8 +11,7 @@ class LoadDataFixturesDoctrineODMCommandTest extends KernelTestCase { - /** @var LoadDataFixturesDoctrineODMCommand */ - private $command; + private LoadDataFixturesDoctrineODMCommand $command; protected function setUp(): void { diff --git a/Tests/ContainerTest.php b/Tests/ContainerTest.php index ddc16c81..05932b2c 100644 --- a/Tests/ContainerTest.php +++ b/Tests/ContainerTest.php @@ -15,11 +15,9 @@ class ContainerTest extends TestCase { - /** @var ContainerBuilder */ - private $container; + private ContainerBuilder $container; - /** @var DoctrineMongoDBExtension */ - private $extension; + private DoctrineMongoDBExtension $extension; protected function setUp(): void { diff --git a/Tests/DataCollector/CommandDataCollectorTest.php b/Tests/DataCollector/CommandDataCollectorTest.php index 30230034..5ab1133d 100644 --- a/Tests/DataCollector/CommandDataCollectorTest.php +++ b/Tests/DataCollector/CommandDataCollectorTest.php @@ -14,10 +14,8 @@ class CommandDataCollectorTest extends TestCase { - /** @var CommandLogger */ - private $commandLogger; - /** @var DocumentManager */ - private $dm; + private CommandLogger $commandLogger; + private DocumentManager $dm; protected function setUp(): void { diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestCustomClassRepoDocument.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestCustomClassRepoDocument.php index b98388bc..7d55d871 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestCustomClassRepoDocument.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestCustomClassRepoDocument.php @@ -14,8 +14,6 @@ class TestCustomClassRepoDocument { /** * @ODM\Id - * - * @var string */ - private $id; + private string $id; } diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestCustomServiceRepoDocument.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestCustomServiceRepoDocument.php index 64211fe4..74ca5ff0 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestCustomServiceRepoDocument.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestCustomServiceRepoDocument.php @@ -14,8 +14,6 @@ class TestCustomServiceRepoDocument { /** * @ODM\Id - * - * @var string */ - private $id; + private string $id; } diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestCustomServiceRepoFile.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestCustomServiceRepoFile.php index ad011da9..c23c66f1 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestCustomServiceRepoFile.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestCustomServiceRepoFile.php @@ -12,8 +12,6 @@ class TestCustomServiceRepoFile { /** * @ODM\Id - * - * @var string */ - private $id; + private string $id; } diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestDefaultRepoDocument.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestDefaultRepoDocument.php index 5472c8da..10bf4f09 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestDefaultRepoDocument.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestDefaultRepoDocument.php @@ -13,8 +13,6 @@ class TestDefaultRepoDocument { /** * @ODM\Id - * - * @var string */ - private $id; + private string $id; } diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestDefaultRepoFile.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestDefaultRepoFile.php index 7b1615e2..9e5c8caa 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestDefaultRepoFile.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Document/TestDefaultRepoFile.php @@ -11,8 +11,6 @@ class TestDefaultRepoFile { /** * @ODM\Id - * - * @var string */ - private $id; + private string $id; } diff --git a/Tests/DependencyInjection/Fixtures/TestKernel.php b/Tests/DependencyInjection/Fixtures/TestKernel.php index 236991ac..84eb2a6d 100644 --- a/Tests/DependencyInjection/Fixtures/TestKernel.php +++ b/Tests/DependencyInjection/Fixtures/TestKernel.php @@ -18,8 +18,7 @@ class TestKernel extends Kernel { - /** @var string|null */ - private $projectDir; + private ?string $projectDir = null; public function __construct(bool $debug = true) { diff --git a/Tests/FixtureIntegrationTest.php b/Tests/FixtureIntegrationTest.php index c78db6fe..fae891f0 100644 --- a/Tests/FixtureIntegrationTest.php +++ b/Tests/FixtureIntegrationTest.php @@ -284,8 +284,7 @@ class IntegrationTestKernel extends Kernel /** @var callable */ private $servicesCallback; - /** @var string */ - private $randomKey; + private string $randomKey; public function __construct(string $environment, bool $debug) { diff --git a/Tests/Fixtures/Cache/Collections.php b/Tests/Fixtures/Cache/Collections.php index e1f44757..652e3712 100644 --- a/Tests/Fixtures/Cache/Collections.php +++ b/Tests/Fixtures/Cache/Collections.php @@ -11,33 +11,17 @@ /** @ODM\Document */ class Collections { - /** - * @ODM\Id - * - * @var ObjectId|null - */ - public $id; - - /** - * @ODM\EmbedMany(collectionClass=SomeCollection::class) - * - * @var SomeCollection - */ - public $coll; - - /** - * @ODM\ReferenceMany(collectionClass=SomeCollection::class) - * - * @var SomeCollection - */ - public $refs; - - /** - * @ODM\EmbedMany(collectionClass=AnotherCollection::class) - * - * @var AnotherCollection - */ - public $another; + /** @ODM\Id */ + public ?ObjectId $id = null; + + /** @ODM\EmbedMany(collectionClass=SomeCollection::class) */ + public SomeCollection $coll; + + /** @ODM\ReferenceMany(collectionClass=SomeCollection::class) */ + public SomeCollection $refs; + + /** @ODM\EmbedMany(collectionClass=AnotherCollection::class) */ + public AnotherCollection $another; } /** @template-extends ArrayCollection */ diff --git a/Tests/Fixtures/CommandBundle/Document/User.php b/Tests/Fixtures/CommandBundle/Document/User.php index 38bf3bcb..e963634b 100644 --- a/Tests/Fixtures/CommandBundle/Document/User.php +++ b/Tests/Fixtures/CommandBundle/Document/User.php @@ -13,8 +13,6 @@ class User { /** * @ODM\Id - * - * @var string|null */ - private $id; + private ?string $id = null; } diff --git a/Tests/Fixtures/DataCollector/Category.php b/Tests/Fixtures/DataCollector/Category.php index 18dc32a7..95e34fd4 100644 --- a/Tests/Fixtures/DataCollector/Category.php +++ b/Tests/Fixtures/DataCollector/Category.php @@ -10,19 +10,11 @@ /** @ODM\Document */ class Category { - /** - * @ODM\Id - * - * @var ObjectId|null - */ - protected $id; + /** @ODM\Id */ + protected ?ObjectId $id = null; - /** - * @ODM\Field(type="string") - * - * @var string - */ - public $name; + /** @ODM\Field(type="string") */ + public string $name; public function __construct(string $name) { diff --git a/Tests/Fixtures/Form/Category.php b/Tests/Fixtures/Form/Category.php index a5e3c6c5..dd1c620a 100644 --- a/Tests/Fixtures/Form/Category.php +++ b/Tests/Fixtures/Form/Category.php @@ -15,16 +15,12 @@ class Category /** * @ODM\Id * - * @var ObjectId|null + * @var ObjectId|string|null */ protected $id; - /** - * @ODM\Field(type="string") - * - * @var string - */ - public $name; + /** @ODM\Field(type="string") */ + public string $name; /** * @ODM\ReferenceMany( @@ -34,7 +30,7 @@ class Category * * @var Collection */ - public $documents; + public Collection $documents; public function __construct(string $name) { diff --git a/Tests/Fixtures/Form/Document.php b/Tests/Fixtures/Form/Document.php index f19aa8e2..7c404613 100644 --- a/Tests/Fixtures/Form/Document.php +++ b/Tests/Fixtures/Form/Document.php @@ -12,19 +12,11 @@ /** @ODM\Document */ class Document { - /** - * @ODM\Id(strategy="none") - * - * @var ObjectId - */ - protected $id; + /** @ODM\Id(strategy="none") */ + protected ObjectId $id; - /** - * @ODM\Field(type="string") - * - * @var string - */ - public $name; + /** @ODM\Field(type="string") */ + public string $name; /** * @ODM\ReferenceMany( @@ -35,7 +27,7 @@ class Document * * @var Collection */ - public $categories; + public Collection $categories; public function __construct(ObjectId $id, string $name) { diff --git a/Tests/Fixtures/Form/Guesser.php b/Tests/Fixtures/Form/Guesser.php index 986737bc..e66d4290 100644 --- a/Tests/Fixtures/Form/Guesser.php +++ b/Tests/Fixtures/Form/Guesser.php @@ -12,33 +12,17 @@ /** @ODM\Document */ class Guesser { - /** - * @ODM\Id(strategy="none") - * - * @var ObjectId|null - */ - protected $id; + /** @ODM\Id(strategy="none") */ + protected ?ObjectId $id = null; - /** - * @ODM\Field() - * - * @var string|null - */ - public $name; + /** @ODM\Field() */ + public ?string $name = null; - /** - * @ODM\Field(type="date") - * - * @var DateTime|null - */ - public $date; + /** @ODM\Field(type="date") */ + public ?DateTime $date = null; - /** - * @ODM\Field(type="timestamp") - * - * @var DateTime - */ - public $ts; + /** @ODM\Field(type="timestamp") */ + public DateTime $ts; /** * @ODM\ReferenceMany( @@ -49,35 +33,23 @@ class Guesser * * @var Collection */ - public $categories; + public Collection $categories; - /** - * @ODM\Field(type="bool") - * - * @var bool|null - */ - public $boolField; + /** @ODM\Field(type="bool") */ + public ?bool $boolField = null; - /** - * @ODM\Field(type="float") - * - * @var float|null - */ - public $floatField; + /** @ODM\Field(type="float") */ + public ?float $floatField = null; - /** - * @ODM\Field(type="int") - * - * @var int|null - */ - public $intField; + /** @ODM\Field(type="int") */ + public ?int $intField = null; /** * @ODM\Field(type="collection") * * @var array */ - public $collectionField; + public array $collectionField; /** @var mixed */ public $nonMappedField; diff --git a/Tests/Fixtures/Security/User.php b/Tests/Fixtures/Security/User.php index 76447ec5..d5696918 100644 --- a/Tests/Fixtures/Security/User.php +++ b/Tests/Fixtures/Security/User.php @@ -11,19 +11,11 @@ /** @ODM\Document */ class User implements UserInterface { - /** - * @ODM\Id(strategy="none") - * - * @var ObjectId - */ - protected $id; + /** @ODM\Id(strategy="none") */ + protected ObjectId $id; - /** - * @ODM\Field(type="string") - * - * @var string - */ - public $name; + /** @ODM\Field(type="string") */ + public string $name; public function __construct(ObjectId $id, string $name) { diff --git a/Tests/Fixtures/Validator/Document.php b/Tests/Fixtures/Validator/Document.php index 7993add8..ae78ff3a 100644 --- a/Tests/Fixtures/Validator/Document.php +++ b/Tests/Fixtures/Validator/Document.php @@ -10,54 +10,38 @@ /** @ODM\Document(collection="DoctrineMongoDBBundle_Tests_Validator_Document") */ class Document { - /** - * @ODM\Id(strategy="none") - * - * @var ObjectId - */ - protected $id; + /** @ODM\Id(strategy="none") */ + protected ObjectId $id; - /** - * @ODM\Field(type="string") - * - * @var string - */ - public $name; + /** @ODM\Field(type="string") */ + public string $name; /** * @ODM\Field(type="hash") * * @var array */ - public $hash; + public array $hash; /** * @ODM\Field(type="collection") * * @var array */ - public $collection; + public array $collection; - /** - * @ODM\ReferenceOne(targetDocument="Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator\Document") - * - * @var Document|null - */ - public $referenceOne; + /** @ODM\ReferenceOne(targetDocument="Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator\Document") */ + public ?Document $referenceOne = null; - /** - * @ODM\EmbedOne(targetDocument="Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator\EmbeddedDocument") - * - * @var EmbeddedDocument|null - */ - public $embedOne; + /** @ODM\EmbedOne(targetDocument="Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator\EmbeddedDocument") */ + public ?EmbeddedDocument $embedOne = null; /** * @ODM\EmbedMany(targetDocument="Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator\EmbeddedDocument") * * @var EmbeddedDocument[] */ - public $embedMany = []; + public array $embedMany = []; public function __construct(ObjectId $id) { @@ -68,10 +52,6 @@ public function __construct(ObjectId $id) /** @ODM\EmbeddedDocument */ class EmbeddedDocument { - /** - * @ODM\Field(type="string") - * - * @var string - */ - public $name; + /** @ODM\Field(type="string") */ + public string $name; } diff --git a/Tests/Form/Type/DocumentTypeTest.php b/Tests/Form/Type/DocumentTypeTest.php index dbb125d6..ab581ddf 100644 --- a/Tests/Form/Type/DocumentTypeTest.php +++ b/Tests/Form/Type/DocumentTypeTest.php @@ -23,11 +23,10 @@ class DocumentTypeTest extends TypeTestCase { - /** @var DocumentManager */ - private $dm; + private DocumentManager $dm; /** @var MockObject&ManagerRegistry */ - private $dmRegistry; + private ManagerRegistry $dmRegistry; protected function setUp(): void { diff --git a/Tests/Form/Type/TypeGuesserTest.php b/Tests/Form/Type/TypeGuesserTest.php index 645216da..79f6c562 100644 --- a/Tests/Form/Type/TypeGuesserTest.php +++ b/Tests/Form/Type/TypeGuesserTest.php @@ -20,11 +20,10 @@ class TypeGuesserTest extends TypeTestCase { - /** @var DocumentManager */ - private $dm; + private DocumentManager $dm; /** @var MockObject&ManagerRegistry */ - private $dmRegistry; + private ManagerRegistry $dmRegistry; protected function setUp(): void { diff --git a/Tests/ServiceRepositoryTest.php b/Tests/ServiceRepositoryTest.php index bf4de926..fe031810 100644 --- a/Tests/ServiceRepositoryTest.php +++ b/Tests/ServiceRepositoryTest.php @@ -33,8 +33,7 @@ class ServiceRepositoryTest extends TestCase { - /** @var ContainerBuilder */ - private $container; + private ContainerBuilder $container; protected function setUp(): void {