Skip to content

Commit

Permalink
Merge pull request #776 from doctrine/4.5.x-merge-up-into-4.6.x_9JgLVdSd
Browse files Browse the repository at this point in the history
Merge release 4.5.3 into 4.6.x
  • Loading branch information
alcaeus authored Jul 26, 2023
2 parents ba28758 + 2d83344 commit a14aee5
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 55 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/composer-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Composer Lint"

on:
pull_request:
branches:
- "*.x"
paths:
- "composer.json"
push:
branches:
- "*.x"
paths:
- "composer.json"

jobs:
composer-lint:
name: "Composer Lint"
uses: "doctrine/.github/.github/workflows/[email protected]"
12 changes: 6 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
with:
fetch-depth: 2

Expand All @@ -67,7 +67,7 @@ jobs:
key: "extcache-v1"

- name: Cache extensions
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"

- name: "Upload coverage file"
uses: "actions/upload-artifact@v2"
uses: "actions/upload-artifact@v3"
with:
name: "phpunit-${{ matrix.php-version }}.coverage"
path: "coverage.xml"
Expand All @@ -110,16 +110,16 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
with:
fetch-depth: 2

- name: "Download coverage files"
uses: "actions/download-artifact@v2"
uses: "actions/download-artifact@v3"
with:
path: "reports"

- name: "Upload to Codecov"
uses: "codecov/codecov-action@v1"
uses: "codecov/codecov-action@v3"
with:
directory: reports
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: "DOCtor-RST"
uses: docker://oskarstark/doctor-rst
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
release:
name: "Git tag, release & create merge-up PR"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@1.4.1"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@3.0.0"
secrets:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: "Checkout code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
Expand All @@ -30,7 +30,7 @@ jobs:
run: "composer config minimum-stability stable"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
uses: "ramsey/composer-install@v2"

- name: "Run a static analysis with vimeo/psalm"
run: "vendor/bin/psalm --show-info=false --stats --output-format=github --threads=$(nproc) --php-version=${{ matrix.php-version }}"
23 changes: 23 additions & 0 deletions DependencyInjection/DoctrineMongoDBExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Doctrine\Common\EventSubscriber;
use Doctrine\ODM\MongoDB\DocumentManager;
use InvalidArgumentException;
use Jean85\PrettyVersions;
use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver;
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension;
Expand All @@ -33,6 +34,7 @@
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\Messenger\MessageBusInterface;
use Throwable;

use function array_keys;
use function array_merge;
Expand All @@ -49,6 +51,9 @@
*/
class DoctrineMongoDBExtension extends AbstractDoctrineExtension
{
/** @var string */
private static $odmVersion;

/** @internal */
public const CONFIGURATION_TAG = 'doctrine.odm.configuration';

Expand Down Expand Up @@ -443,6 +448,11 @@ private function normalizeDriverOptions(array $connection): array
$driverOptions['context'] = new Reference($driverOptions['context']);
}

$driverOptions['driver'] = [
'name' => 'symfony-mongodb',
'version' => self::getODMVersion(),
];

return $driverOptions;
}

Expand Down Expand Up @@ -633,4 +643,17 @@ protected function loadCacheDriver(string $cacheName, string $objectManagerName,

return $cacheDriverServiceId;
}

private static function getODMVersion(): string
{
if (self::$odmVersion === null) {
try {
self::$odmVersion = PrettyVersions::getVersion('doctrine/mongodb-odm')->getPrettyVersion();
} catch (Throwable $t) {
return 'unknown';
}
}

return self::$odmVersion;
}
}
2 changes: 0 additions & 2 deletions Resources/doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ following line in the ``config/bundles.php`` file of your project:
.. code-block:: php
// config/bundles.php
<?php
return [
// ...
Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle::class => ['all' => true],
Expand Down
4 changes: 1 addition & 3 deletions Tests/Command/CommandTestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\Loader\Configurator\RouteConfigurator;
use Symfony\Component\Routing\RouteCollectionBuilder;

use function sys_get_temp_dir;

Expand All @@ -32,8 +31,7 @@ public function registerBundles(): array
];
}

/** @param RouteConfigurator|RouteCollectionBuilder $routes */
public function configureRoutes($routes): void
public function configureRoutes(RouteConfigurator $routes): void
{
}

Expand Down
4 changes: 1 addition & 3 deletions Tests/FixtureIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\Loader\Configurator\RouteConfigurator;
use Symfony\Component\Routing\RouteCollectionBuilder;

use function array_map;
use function assert;
Expand Down Expand Up @@ -310,8 +309,7 @@ public function addServices(callable $callback): void
$this->servicesCallback = $callback;
}

/** @param RouteConfigurator|RouteCollectionBuilder $routes */
protected function configureRoutes($routes): void
protected function configureRoutes(RouteConfigurator $routes): void
{
}

Expand Down
70 changes: 42 additions & 28 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,65 @@
{
"name": "doctrine/mongodb-odm-bundle",
"type": "symfony-bundle",
"description": "Symfony Doctrine MongoDB Bundle",
"keywords": ["persistence", "mongodb", "symfony"],
"homepage": "http://www.doctrine-project.org",
"license": "MIT",
"minimum-stability": "stable",
"type": "symfony-bundle",
"keywords": [
"persistence",
"mongodb",
"symfony"
],
"authors": [
{"name": "Bulat Shakirzyanov", "email": "[email protected]"},
{"name": "Kris Wallsmith", "email": "[email protected]"},
{"name": "Jonathan H. Wage", "email": "[email protected]"}
{
"name": "Bulat Shakirzyanov",
"email": "[email protected]"
},
{
"name": "Kris Wallsmith",
"email": "[email protected]"
},
{
"name": "Jonathan H. Wage",
"email": "[email protected]"
}
],
"homepage": "http://www.doctrine-project.org",
"require": {
"php": "^7.4 || ^8.0",
"ext-mongodb": "^1.5",
"doctrine/annotations": "^1.13 || ^2.0",
"doctrine/mongodb-odm": "^2.3",
"doctrine/persistence": "^2.2|^3.0",
"psr/log": "^1.0|^2.0|^3.0",
"symfony/config": "^5.4|^6.2",
"symfony/console": "^5.4|^6.2",
"symfony/dependency-injection": "^5.4|^6.2",
"symfony/deprecation-contracts": "^2.1|^3.0",
"symfony/doctrine-bridge": "^5.4.19|^6.2",
"symfony/framework-bundle": "^5.4|^6.2",
"symfony/http-kernel": "^5.4|^6.2",
"symfony/options-resolver": "^5.4|^6.2"
},
"conflict": {
"doctrine/data-fixtures": "<1.3"
"doctrine/persistence": "^2.2 || ^3.0",
"jean85/pretty-package-versions": "^1.3.0 || ^2.0.1",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"symfony/config": "^5.4 || ^6.2",
"symfony/console": "^5.4 || ^6.2",
"symfony/dependency-injection": "^5.4 || ^6.2",
"symfony/deprecation-contracts": "^2.1 || ^3.0",
"symfony/doctrine-bridge": "^5.4.19 || ^6.2",
"symfony/framework-bundle": "^5.4 || ^6.2",
"symfony/http-kernel": "^5.4 || ^6.2",
"symfony/options-resolver": "^5.4 || ^6.2"
},
"require-dev": {
"doctrine/coding-standard": "^11.0",
"doctrine/data-fixtures": "^1.3",
"phpunit/phpunit": "^9.5.5",
"psalm/plugin-symfony": "^5.0",
"symfony/form": "^5.4|^6.2",
"symfony/form": "^5.4 || ^6.2",
"symfony/phpunit-bridge": "^6.2",
"symfony/security-bundle": "^5.4|^6.2",
"symfony/stopwatch": "^5.4|^6.2",
"symfony/validator": "^5.4|^6.2",
"symfony/yaml": "^5.4|^6.2",
"vimeo/psalm": "^5.6"
"symfony/security-bundle": "^5.4 || ^6.2",
"symfony/stopwatch": "^5.4 || ^6.2",
"symfony/validator": "^5.4 || ^6.2",
"symfony/yaml": "^5.4 || ^6.2",
"vimeo/psalm": "^5.12"
},
"conflict": {
"doctrine/data-fixtures": "<1.3"
},
"suggest": {
"doctrine/data-fixtures": "Load data fixtures"
},
"minimum-stability": "stable",
"autoload": {
"psr-4": {
"Doctrine\\Bundle\\MongoDBBundle\\": ""
Expand All @@ -60,9 +74,9 @@
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"sort-packages": true
}
}
18 changes: 17 additions & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.6.0@e784128902dfe01d489c4123d69918a9f3c1eac5">
<files psalm-version="5.12.0@f90118cdeacd0088e7215e64c0c99ceca819e176">
<file src="Command/LoadDataFixturesDoctrineODMCommand.php">
<UndefinedInterfaceMethod>
<code>ask</code>
Expand All @@ -10,6 +10,22 @@
<code>int</code>
</InvalidReturnType>
</file>
<file src="DependencyInjection/Configuration.php">
<UndefinedInterfaceMethod>
<code>arrayNode</code>
<code>end</code>
<code>scalarNode</code>
<code>scalarNode</code>
</UndefinedInterfaceMethod>
<UndefinedMethod>
<code>children</code>
</UndefinedMethod>
</file>
<file src="Form/Type/DocumentType.php">
<MethodSignatureMustProvideReturnType>
<code>configureOptions</code>
</MethodSignatureMustProvideReturnType>
</file>
<file src="Tests/Form/Type/GuesserTestType.php">
<MissingTemplateParam>
<code>GuesserTestType</code>
Expand Down
8 changes: 0 additions & 8 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,4 @@
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>

<issueHandlers>
<UndefinedDocblockClass>
<errorLevel type="info">
<referencedClass name="Symfony\Component\Routing\RouteCollectionBuilder" /> <!-- for backwards compatibility with symfony/routing ^4.4 -->
</errorLevel>
</UndefinedDocblockClass>
</issueHandlers>
</psalm>

0 comments on commit a14aee5

Please sign in to comment.