From 8b31609ccdd0b53b0c377f15655d6c867a803adb Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Fri, 13 Jan 2023 01:49:49 +0100 Subject: [PATCH 1/5] CI: Update GH actions --- .github/workflows/composer-lint.yml | 18 ++++++++++++++++++ .github/workflows/continuous-integration.yml | 12 ++++++------ .github/workflows/lint.yaml | 2 +- .../workflows/release-on-milestone-closed.yml | 2 +- .github/workflows/static-analysis.yml | 4 ++-- 5 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/composer-lint.yml diff --git a/.github/workflows/composer-lint.yml b/.github/workflows/composer-lint.yml new file mode 100644 index 00000000..363a47ef --- /dev/null +++ b/.github/workflows/composer-lint.yml @@ -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/composer-lint.yml@3.0.0" diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7a9310c2..cd6f7a49 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -61,7 +61,7 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2" + uses: "actions/checkout@v3" with: fetch-depth: 2 @@ -74,7 +74,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 }} @@ -104,7 +104,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" @@ -117,16 +117,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 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 10d35c4d..274fd090 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -10,7 +10,7 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: "DOCtor-RST" uses: docker://oskarstark/doctor-rst diff --git a/.github/workflows/release-on-milestone-closed.yml b/.github/workflows/release-on-milestone-closed.yml index 9ce2a0fe..3f282946 100644 --- a/.github/workflows/release-on-milestone-closed.yml +++ b/.github/workflows/release-on-milestone-closed.yml @@ -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 }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index fef75ccc..fcf3bf5a 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -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" @@ -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 }}" From 78849b4489e805e8e8ec3209de3ef936c5aa255f Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Thu, 20 Jul 2023 13:14:20 +0200 Subject: [PATCH 2/5] Fix missing driver instrumentation (#775) --- .../DoctrineMongoDBExtension.php | 23 +++++++++++++++++++ composer.json | 1 + 2 files changed, 24 insertions(+) diff --git a/DependencyInjection/DoctrineMongoDBExtension.php b/DependencyInjection/DoctrineMongoDBExtension.php index df048cf7..e6fdcd1b 100644 --- a/DependencyInjection/DoctrineMongoDBExtension.php +++ b/DependencyInjection/DoctrineMongoDBExtension.php @@ -16,6 +16,7 @@ use Doctrine\Common\EventSubscriber; use Doctrine\ODM\MongoDB\DocumentManager; use InvalidArgumentException; +use Jean85\PrettyVersions; use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension; use Symfony\Bridge\Doctrine\Messenger\DoctrineClearEntityManagerWorkerSubscriber; use Symfony\Component\Cache\Adapter\ApcuAdapter; @@ -31,6 +32,7 @@ use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\Messenger\MessageBusInterface; +use Throwable; use function array_keys; use function array_merge; @@ -48,6 +50,9 @@ */ class DoctrineMongoDBExtension extends AbstractDoctrineExtension { + /** @var string */ + private static $odmVersion; + /** @internal */ public const CONFIGURATION_TAG = 'doctrine.odm.configuration'; @@ -407,6 +412,11 @@ private function normalizeDriverOptions(array $connection) $driverOptions['context'] = new Reference($driverOptions['context']); } + $driverOptions['driver'] = [ + 'name' => 'symfony-mongodb', + 'version' => self::getODMVersion(), + ]; + return $driverOptions; } @@ -610,4 +620,17 @@ private function buildDeprecationArgs(string $version, string $message): array ? ['doctrine/mongodb-odm-bundle', $version, $message] : [$message]; } + + 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; + } } diff --git a/composer.json b/composer.json index 2d320fde..ff7752b6 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "doctrine/annotations": "^1.13", "doctrine/mongodb-odm": "^2.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": "^4.4|^5.3|^6.0", "symfony/console": "^4.4.6|^5.3|^6.0", From 6ce7fe62192e4099c132da5617916b2c6e3f6212 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Tue, 14 Mar 2023 06:56:14 +0100 Subject: [PATCH 3/5] Fix rst --- Resources/doc/installation.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/Resources/doc/installation.rst b/Resources/doc/installation.rst index d1171764..7521c465 100644 --- a/Resources/doc/installation.rst +++ b/Resources/doc/installation.rst @@ -42,8 +42,6 @@ following line in the ``config/bundles.php`` file of your project: .. code-block:: php // config/bundles.php - ['all' => true], From e4062ed4efd209444717b73f45d5eb6823f5e9f6 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Fri, 31 Mar 2023 14:11:27 +0200 Subject: [PATCH 4/5] Fix psalm issues --- Tests/Command/CommandTestKernel.php | 4 +--- Tests/FixtureIntegrationTest.php | 4 +--- composer.json | 2 +- psalm-baseline.xml | 18 +++++++++++++++++- psalm.xml | 8 -------- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Tests/Command/CommandTestKernel.php b/Tests/Command/CommandTestKernel.php index 24019ecb..bc6958dd 100644 --- a/Tests/Command/CommandTestKernel.php +++ b/Tests/Command/CommandTestKernel.php @@ -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; @@ -32,8 +31,7 @@ public function registerBundles(): array ]; } - /** @param RouteConfigurator|RouteCollectionBuilder $routes */ - public function configureRoutes($routes): void + public function configureRoutes(RouteConfigurator $routes): void { } diff --git a/Tests/FixtureIntegrationTest.php b/Tests/FixtureIntegrationTest.php index 3f454c61..91e36f2d 100644 --- a/Tests/FixtureIntegrationTest.php +++ b/Tests/FixtureIntegrationTest.php @@ -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; @@ -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 { } diff --git a/composer.json b/composer.json index 4142d1ab..42cff697 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "symfony/stopwatch": "^5.4|^6.2", "symfony/validator": "^5.4|^6.2", "symfony/yaml": "^5.4|^6.2", - "vimeo/psalm": "^5.6" + "vimeo/psalm": "^5.12" }, "suggest": { "doctrine/data-fixtures": "Load data fixtures" diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 1ae71a89..07ad85e6 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + ask @@ -10,6 +10,22 @@ int + + + arrayNode + end + scalarNode + scalarNode + + + children + + + + + configureOptions + + GuesserTestType diff --git a/psalm.xml b/psalm.xml index af67c53b..6659793d 100644 --- a/psalm.xml +++ b/psalm.xml @@ -34,12 +34,4 @@ - - - - - - - - From 2d833444645bf1f6c1c16971b6863df89e9fac73 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Wed, 26 Jul 2023 11:04:33 +0200 Subject: [PATCH 5/5] Normalize composer --- composer.json | 67 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/composer.json b/composer.json index 42cff697..d86f8c68 100644 --- a/composer.json +++ b/composer.json @@ -1,52 +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": "mallluhuct@gmail.com"}, - {"name": "Kris Wallsmith", "email": "kris@symfony.com"}, - {"name": "Jonathan H. Wage", "email": "jonwage@gmail.com"} + { + "name": "Bulat Shakirzyanov", + "email": "mallluhuct@gmail.com" + }, + { + "name": "Kris Wallsmith", + "email": "kris@symfony.com" + }, + { + "name": "Jonathan H. Wage", + "email": "jonwage@gmail.com" + } ], + "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", + "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" - }, - "conflict": { - "doctrine/data-fixtures": "<1.3" + "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", + "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\\": "" @@ -61,9 +74,9 @@ } }, "config": { - "sort-packages": true, "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true - } + }, + "sort-packages": true } }