Skip to content

Commit

Permalink
feat: Symfony 7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond committed Dec 9, 2023
1 parent 8a31e71 commit c969393
Show file tree
Hide file tree
Showing 20 changed files with 77 additions and 83 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
symfony-version:
- "5.4.*"
- "6.4.*"
- "7.0.x"
driver-version:
- "stable"
dependencies:
Expand All @@ -41,6 +42,9 @@ jobs:
driver-version: "1.5.0"
stability: "stable"
symfony-version: "5.4.*"
exclude:
- php-version: "8.1"
symfony-version: "7.0.x"

services:
mongodb:
Expand Down
4 changes: 2 additions & 2 deletions CacheWarmer/HydratorCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public function __construct(private ContainerInterface $container)
*
* @return false
*/
public function isOptional()
public function isOptional(): bool
{
return false;
}

/** @return string[] */
public function warmUp(string $cacheDir, ?string $buildDir = null)
public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
// we need the directory no matter the hydrator cache generation strategy.
$hydratorCacheDir = (string) $this->container->getParameter('doctrine_mongodb.odm.hydrator_dir');
Expand Down
4 changes: 2 additions & 2 deletions CacheWarmer/PersistentCollectionCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public function __construct(private ContainerInterface $container)
*
* @return false
*/
public function isOptional()
public function isOptional(): bool
{
return false;
}

/** @return string[] */
public function warmUp(string $cacheDir, ?string $buildDir = null)
public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
// we need the directory no matter the hydrator cache generation strategy.
$collCacheDir = (string) $this->container->getParameter('doctrine_mongodb.odm.persistent_collection_dir');
Expand Down
4 changes: 2 additions & 2 deletions CacheWarmer/ProxyCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public function __construct(private ContainerInterface $container)
*
* @return false
*/
public function isOptional()
public function isOptional(): bool
{
return false;
}

/** @return string[] */
public function warmUp(string $cacheDir, ?string $buildDir = null)
public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
// we need the directory no matter the proxy cache generation strategy.
$proxyCacheDir = (string) $this->container->getParameter('doctrine_mongodb.odm.proxy_dir');
Expand Down
8 changes: 4 additions & 4 deletions Command/ClearMetadataCacheDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

/**
* Command to clear the metadata cache of the various cache drivers.
*
* @internal since 4.7
*/
class ClearMetadataCacheDoctrineODMCommand extends MetadataCommand
{
/** @return void */
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -35,8 +36,7 @@ protected function configure()
);
}

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

Expand Down
8 changes: 4 additions & 4 deletions Command/CreateSchemaDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
/**
* Command to create the database schema for a set of classes based on their
* mappings.
*
* @internal since 4.7
*/
class CreateSchemaDoctrineODMCommand extends CreateCommand
{
/** @return void */
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -35,8 +36,7 @@ protected function configure()
);
}

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

Expand Down
8 changes: 4 additions & 4 deletions Command/DropSchemaDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
/**
* Command to drop the database schema for a set of classes based on their
* mappings.
*
* @internal since 4.7
*/
class DropSchemaDoctrineODMCommand extends DropCommand
{
/** @return void */
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -35,8 +36,7 @@ protected function configure()
);
}

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

Expand Down
8 changes: 4 additions & 4 deletions Command/GenerateHydratorsDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

/**
* Generate the Doctrine ORM document hydrators to your cache directory.
*
* @internal since 4.7
*/
class GenerateHydratorsDoctrineODMCommand extends GenerateHydratorsCommand
{
/** @return void */
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -34,8 +35,7 @@ protected function configure()
);
}

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

Expand Down
8 changes: 4 additions & 4 deletions Command/GenerateProxiesDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

/**
* Generate the Doctrine ORM document proxies to your cache directory.
*
* @internal since 4.7
*/
class GenerateProxiesDoctrineODMCommand extends GenerateProxiesCommand
{
/** @return void */
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -34,8 +35,7 @@ protected function configure()
);
}

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

Expand Down
8 changes: 4 additions & 4 deletions Command/InfoDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

/**
* Show information about mapped documents
*
* @internal since 4.7
*/
class InfoDoctrineODMCommand extends DoctrineODMCommand
{
/** @return void */
protected function configure()
protected function configure(): void
{
$this
->setName('doctrine:mongodb:mapping:info')
Expand All @@ -40,8 +41,7 @@ protected function configure()
);
}

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

Expand Down
11 changes: 5 additions & 6 deletions Command/LoadDataFixturesDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

/**
* Load data fixtures from bundles.
*
* @internal since 4.7
*/
class LoadDataFixturesDoctrineODMCommand extends DoctrineODMCommand
{
Expand All @@ -32,14 +34,12 @@ public function __construct(?ManagerRegistry $registry = null, ?KernelInterface
parent::__construct($registry);
}

/** @return bool */
public function isEnabled()
public function isEnabled(): bool
{
return parent::isEnabled() && class_exists(Loader::class);
}

/** @return void */
protected function configure()
protected function configure(): void
{
$this
->setName('doctrine:mongodb:fixtures:load')
Expand Down Expand Up @@ -69,8 +69,7 @@ protected function configure()
);
}

/** @return int */
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$dm = $this->getManagerRegistry()->getManager($input->getOption('dm'));
$ui = new SymfonyStyle($input, $output);
Expand Down
8 changes: 4 additions & 4 deletions Command/QueryDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

/**
* Execute a Doctrine MongoDB ODM query and output the results.
*
* @internal since 4.7
*/
class QueryDoctrineODMCommand extends QueryCommand
{
/** @return void */
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -24,8 +25,7 @@ protected function configure()
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.');
}

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

Expand Down
8 changes: 4 additions & 4 deletions Command/ShardDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
/**
* Command to shard database collections for a set of classes based on their
* mappings.
*
* @internal since 4.7
*/
class ShardDoctrineODMCommand extends ShardCommand
{
/** @return void */
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -35,8 +36,7 @@ protected function configure()
);
}

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

Expand Down
6 changes: 2 additions & 4 deletions Command/TailCursorDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class TailCursorDoctrineODMCommand extends Command implements ContainerAwareInte
/** @var ContainerInterface|null */
protected $container;

/** @return void */
protected function configure()
protected function configure(): void
{
$this
->setName('doctrine:mongodb:tail-cursor')
Expand All @@ -43,8 +42,7 @@ protected function configure()
->addOption('sleep-time', null, InputOption::VALUE_REQUIRED, 'The number of seconds to wait between two checks.', '10');
}

/** @return int */
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
trigger_deprecation(
'doctrine/mongodb-odm-bundle',
Expand Down
8 changes: 4 additions & 4 deletions Command/UpdateSchemaDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
/**
* Command to update the database schema for a set of classes based on their
* mappings.
*
* @internal since 4.7
*/
class UpdateSchemaDoctrineODMCommand extends UpdateCommand
{
/** @return void */
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -35,8 +36,7 @@ protected function configure()
);
}

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

Expand Down
4 changes: 1 addition & 3 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ class Configuration implements ConfigurationInterface
{
/**
* Generates the configuration tree builder.
*
* @return TreeBuilder
*/
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('doctrine_mongodb');
$rootNode = $treeBuilder->getRootNode();
Expand Down
5 changes: 2 additions & 3 deletions Form/DoctrineMongoDBExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ public function __construct(ManagerRegistry $registry)
}

/** @return FormTypeInterface[] */
protected function loadTypes()
protected function loadTypes(): array
{
return [
new Type\DocumentType($this->registry),
];
}

/** @return FormTypeGuesserInterface|null */
protected function loadTypeGuesser()
protected function loadTypeGuesser(): ?FormTypeGuesserInterface
{
return new DoctrineMongoDBTypeGuesser($this->registry);
}
Expand Down
Loading

0 comments on commit c969393

Please sign in to comment.