Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecations using Symfony 5.4 #707

Merged
merged 5 commits into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ jobs:
- "7.3"
- "7.4"
- "8.0"
stability:
- "stable"
symfony-version:
- "4.4.x"
- "5.1.x"
- "5.3.x"
driver-version:
- "stable"
dependencies:
Expand All @@ -38,7 +40,14 @@ jobs:
os: "ubuntu-20.04"
php-version: "7.2"
driver-version: "1.5.0"
stability: "stable"
symfony-version: "4.4.*"
- dependencies: "highest"
os: "ubuntu-20.04"
driver-version: "stable"
php-version: "8.0"
stability: "dev"
symfony-version: "5.4.*"

services:
mongodb:
Expand Down Expand Up @@ -80,7 +89,7 @@ jobs:
run: "composer global require --no-progress --no-scripts --no-plugins symfony/flex"

- name: "Set minimum-stability to stable in Composer"
run: "composer config minimum-stability stable"
run: "composer config minimum-stability ${{ matrix.stability }}"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
Expand Down
4 changes: 3 additions & 1 deletion CacheWarmer/HydratorCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public function isOptional()
}

/**
* {@inheritDoc}
* @param string $cacheDir
*
* @return string[]
*/
public function warmUp($cacheDir)
{
Expand Down
4 changes: 3 additions & 1 deletion CacheWarmer/PersistentCollectionCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public function isOptional()
}

/**
* {@inheritDoc}
* @param string $cacheDir
*
* @return string[]
*/
public function warmUp($cacheDir)
{
Expand Down
4 changes: 3 additions & 1 deletion CacheWarmer/ProxyCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public function isOptional()
}

/**
* {@inheritDoc}
* @param string $cacheDir
*
* @return string[]
*/
public function warmUp($cacheDir)
{
Expand Down
12 changes: 7 additions & 5 deletions DependencyInjection/DoctrineMongoDBExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,31 +457,33 @@ protected function loadDocumentManagerBundlesMappingInformation(array $documentM
}

/**
* {@inheritDoc}
* @param string $name
*
* @return string
*/
protected function getObjectManagerElementName($name)
{
return 'doctrine_mongodb.odm.' . $name;
}

/**
* {@inheritDoc}
* @return string
*/
protected function getMappingObjectDefaultName()
{
return 'Document';
}

/**
* {@inheritDoc}
* @return string
*/
protected function getMappingResourceConfigDirectory()
{
return 'Resources/config/doctrine';
}

/**
* {@inheritDoc}
* @return string
*/
protected function getMappingResourceExtension()
{
Expand All @@ -494,7 +496,7 @@ protected function getMetadataDriverClass(string $driverType): string
}

/**
* {@inheritDoc}
* @return string
*/
public function getAlias()
{
Expand Down
3 changes: 2 additions & 1 deletion DoctrineMongoDBBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;

use function assert;
Expand Down Expand Up @@ -56,7 +57,7 @@ public function build(ContainerBuilder $container)
}

/**
* {@inheritDoc}
* @return ExtensionInterface|null
*/
public function getContainerExtension()
{
Expand Down
6 changes: 4 additions & 2 deletions Form/ChoiceList/MongoDBQueryBuilderLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ public function __construct($queryBuilder, ?ObjectManager $manager = null, $clas
}

/**
* {@inheritDoc}
* @return object[]
*/
public function getEntities()
{
return array_values($this->queryBuilder->getQuery()->execute()->toArray());
}

/**
* {@inheritDoc}
* @param string $identifier
*
* @return object[]
*/
public function getEntitiesByIds($identifier, array $values)
{
Expand Down
6 changes: 4 additions & 2 deletions Form/DoctrineMongoDBExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Form\AbstractExtension;
use Symfony\Component\Form\FormTypeGuesserInterface;
use Symfony\Component\Form\FormTypeInterface;

/**
* Form extension.
Expand All @@ -21,7 +23,7 @@ public function __construct(ManagerRegistry $registry)
}

/**
* {@inheritDoc}
* @return FormTypeInterface[]
*/
protected function loadTypes()
{
Expand All @@ -31,7 +33,7 @@ protected function loadTypes()
}

/**
* {@inheritDoc}
* @return FormTypeGuesserInterface|null
*/
protected function loadTypeGuesser()
{
Expand Down
20 changes: 16 additions & 4 deletions Form/DoctrineMongoDBTypeGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public function __construct(ManagerRegistry $registry)
}

/**
* @inheritDoc
* @param string $class
* @param string $property
*
* @return TypeGuess|null
*/
public function guessType($class, $property)
{
Expand Down Expand Up @@ -118,7 +121,10 @@ public function guessType($class, $property)
}

/**
* @inheritDoc
* @param string $class
* @param string $property
*
* @return ValueGuess|null
*/
public function guessRequired($class, $property)
{
Expand All @@ -139,7 +145,10 @@ public function guessRequired($class, $property)
}

/**
* @inheritDoc
* @param string $class
* @param string $property
*
* @return ValueGuess|null
*/
public function guessMaxLength($class, $property)
{
Expand Down Expand Up @@ -167,7 +176,10 @@ public function guessMinLength($class, $property)
}

/**
* @inheritDoc
* @param string $class
* @param string $property
*
* @return ValueGuess|null
*/
public function guessPattern($class, $property)
{
Expand Down
6 changes: 5 additions & 1 deletion Form/Type/DocumentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\Persistence\ObjectManager;
use InvalidArgumentException;
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
use Symfony\Bridge\Doctrine\Form\Type\DoctrineType;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
Expand All @@ -20,7 +21,10 @@
class DocumentType extends DoctrineType
{
/**
* {@inheritDoc}
* @param object $queryBuilder
* @param string $class
*
* @return EntityLoaderInterface
*/
public function getLoader(ObjectManager $manager, $queryBuilder, $class)
{
Expand Down
9 changes: 8 additions & 1 deletion Tests/APM/StopwatchCommandLoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use Doctrine\ODM\MongoDB\DocumentManager;
use Symfony\Component\Stopwatch\Stopwatch;

use function method_exists;

class StopwatchCommandLoggerTest extends TestCase
{
/** @var StopwatchCommandLogger */
Expand Down Expand Up @@ -56,7 +58,12 @@ public function testItLogsStopwatchEvents(): void

foreach ($events as $eventName => $stopwatchEvent) {
// @todo replace with assertMatchesRegularExpression() when PHP 7.2 is dropped
self::assertRegExp('/mongodb_\d+/', $eventName);
if (method_exists($this, 'assertMatchesRegularExpression')) {
self::assertMatchesRegularExpression('/mongodb_\d+/', $eventName);
} else {
self::assertRegExp('/mongodb_\d+/', $eventName);
}

self::assertGreaterThan(0, $stopwatchEvent->getDuration());
self::assertSame('doctrine_mongodb', $stopwatchEvent->getCategory());
}
Expand Down
7 changes: 3 additions & 4 deletions Tests/FixtureIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
use function array_map;
use function assert;
use function get_class;
use function rand;
use function sprintf;
use function sys_get_temp_dir;
use function uniqid;

class FixtureIntegrationTest extends TestCase
{
Expand Down Expand Up @@ -283,13 +283,12 @@ class IntegrationTestKernel extends Kernel
/** @var callable */
private $servicesCallback;

/** @var int */
/** @var string */
private $randomKey;

public function __construct(string $environment, bool $debug)
{
$this->randomKey = rand(100, 999);

$this->randomKey = uniqid('');
parent::__construct($environment, $debug);
}

Expand Down
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@
</exclude>
</whitelist>
</filter>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
IonBazan marked this conversation as resolved.
Show resolved Hide resolved
</listeners>
</phpunit>