Skip to content

Commit c3cf6ac

Browse files
authored
Add return types required by extending Symfony classes (#797)
1 parent 9fcfc1b commit c3cf6ac

23 files changed

+44
-119
lines changed

CacheWarmer/HydratorCacheWarmer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ public function __construct(private ContainerInterface $container)
4040
*
4141
* @return false
4242
*/
43-
public function isOptional()
43+
public function isOptional(): bool
4444
{
4545
return false;
4646
}
4747

4848
/** @return string[] */
49-
public function warmUp(string $cacheDir, ?string $buildDir = null)
49+
public function warmUp(string $cacheDir, ?string $buildDir = null): array
5050
{
5151
// we need the directory no matter the hydrator cache generation strategy.
5252
$hydratorCacheDir = (string) $this->container->getParameter('doctrine_mongodb.odm.hydrator_dir');

CacheWarmer/PersistentCollectionCacheWarmer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ public function __construct(private ContainerInterface $container)
4141
*
4242
* @return false
4343
*/
44-
public function isOptional()
44+
public function isOptional(): bool
4545
{
4646
return false;
4747
}
4848

4949
/** @return string[] */
50-
public function warmUp(string $cacheDir, ?string $buildDir = null)
50+
public function warmUp(string $cacheDir, ?string $buildDir = null): array
5151
{
5252
// we need the directory no matter the hydrator cache generation strategy.
5353
$collCacheDir = (string) $this->container->getParameter('doctrine_mongodb.odm.persistent_collection_dir');

CacheWarmer/ProxyCacheWarmer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ public function __construct(private ContainerInterface $container)
4242
*
4343
* @return false
4444
*/
45-
public function isOptional()
45+
public function isOptional(): bool
4646
{
4747
return false;
4848
}
4949

5050
/** @return string[] */
51-
public function warmUp(string $cacheDir, ?string $buildDir = null)
51+
public function warmUp(string $cacheDir, ?string $buildDir = null): array
5252
{
5353
// we need the directory no matter the proxy cache generation strategy.
5454
$proxyCacheDir = (string) $this->container->getParameter('doctrine_mongodb.odm.proxy_dir');
@@ -76,7 +76,7 @@ public function warmUp(string $cacheDir, ?string $buildDir = null)
7676
}
7777

7878
/** @return ClassMetadata[] */
79-
private function getClassesForProxyGeneration(DocumentManager $dm)
79+
private function getClassesForProxyGeneration(DocumentManager $dm): array
8080
{
8181
return array_filter($dm->getMetadataFactory()->getAllMetadata(), static fn (ClassMetadata $metadata) => ! $metadata->isEmbeddedDocument && ! $metadata->isMappedSuperclass);
8282
}

Command/ClearMetadataCacheDoctrineODMCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
*/
1515
class ClearMetadataCacheDoctrineODMCommand extends MetadataCommand
1616
{
17-
/** @return void */
18-
protected function configure()
17+
protected function configure(): void
1918
{
2019
parent::configure();
2120

@@ -35,8 +34,7 @@ protected function configure()
3534
);
3635
}
3736

38-
/** @return int */
39-
protected function execute(InputInterface $input, OutputInterface $output)
37+
protected function execute(InputInterface $input, OutputInterface $output): int
4038
{
4139
DoctrineODMCommand::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm'));
4240

Command/CreateSchemaDoctrineODMCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
*/
1616
class CreateSchemaDoctrineODMCommand extends CreateCommand
1717
{
18-
/** @return void */
19-
protected function configure()
18+
protected function configure(): void
2019
{
2120
parent::configure();
2221

@@ -35,8 +34,7 @@ protected function configure()
3534
);
3635
}
3736

38-
/** @return int */
39-
protected function execute(InputInterface $input, OutputInterface $output)
37+
protected function execute(InputInterface $input, OutputInterface $output): int
4038
{
4139
DoctrineODMCommand::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm'));
4240

Command/DoctrineODMCommand.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,14 @@ public function __construct(private ManagerRegistry $registry)
2222
}
2323

2424
/** @param string $dmName */
25-
public static function setApplicationDocumentManager(Application $application, $dmName)
25+
public static function setApplicationDocumentManager(Application $application, $dmName): void
2626
{
2727
$dm = $application->getKernel()->getContainer()->get('doctrine_mongodb')->getManager($dmName);
2828
$helperSet = $application->getHelperSet();
2929
$helperSet->set(new DocumentManagerHelper($dm), 'dm');
3030
}
3131

32-
/**
33-
* @internal
34-
*
35-
* @return ManagerRegistry
36-
*/
37-
protected function getManagerRegistry()
32+
protected function getManagerRegistry(): ManagerRegistry
3833
{
3934
return $this->registry;
4035
}

Command/DropSchemaDoctrineODMCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
*/
1616
class DropSchemaDoctrineODMCommand extends DropCommand
1717
{
18-
/** @return void */
19-
protected function configure()
18+
protected function configure(): void
2019
{
2120
parent::configure();
2221

@@ -35,8 +34,7 @@ protected function configure()
3534
);
3635
}
3736

38-
/** @return int */
39-
protected function execute(InputInterface $input, OutputInterface $output)
37+
protected function execute(InputInterface $input, OutputInterface $output): int
4038
{
4139
DoctrineODMCommand::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm'));
4240

Command/GenerateHydratorsDoctrineODMCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
*/
1515
class GenerateHydratorsDoctrineODMCommand extends GenerateHydratorsCommand
1616
{
17-
/** @return void */
18-
protected function configure()
17+
protected function configure(): void
1918
{
2019
parent::configure();
2120

@@ -34,8 +33,7 @@ protected function configure()
3433
);
3534
}
3635

37-
/** @return int */
38-
protected function execute(InputInterface $input, OutputInterface $output)
36+
protected function execute(InputInterface $input, OutputInterface $output): int
3937
{
4038
DoctrineODMCommand::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm'));
4139

Command/GenerateProxiesDoctrineODMCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
*/
1515
class GenerateProxiesDoctrineODMCommand extends GenerateProxiesCommand
1616
{
17-
/** @return void */
18-
protected function configure()
17+
protected function configure(): void
1918
{
2019
parent::configure();
2120

@@ -34,8 +33,7 @@ protected function configure()
3433
);
3534
}
3635

37-
/** @return int */
38-
protected function execute(InputInterface $input, OutputInterface $output)
36+
protected function execute(InputInterface $input, OutputInterface $output): int
3937
{
4038
DoctrineODMCommand::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm'));
4139

Command/InfoDoctrineODMCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
*/
2121
class InfoDoctrineODMCommand extends DoctrineODMCommand
2222
{
23-
/** @return void */
24-
protected function configure()
23+
protected function configure(): void
2524
{
2625
$this
2726
->setName('doctrine:mongodb:mapping:info')
@@ -40,8 +39,7 @@ protected function configure()
4039
);
4140
}
4241

43-
/** @return int */
44-
protected function execute(InputInterface $input, OutputInterface $output)
42+
protected function execute(InputInterface $input, OutputInterface $output): int
4543
{
4644
$documentManagerName = $input->hasOption('dm') ? $input->getOption('dm') : $this->getManagerRegistry()->getDefaultManagerName();
4745

0 commit comments

Comments
 (0)