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

Allow Symfony 7.0 #17

Closed
wants to merge 8 commits into from
Closed
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
23 changes: 11 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,32 @@ jobs:
dependencies: ['highest']
description: ['Tests']
php:
- 8.1
- 8.0
- 7.4
- 7.3
# - 8.1
# - 8.2
# - 8.3
include:
- description: Tests - Symfony 5.4 LTS
php: 7.4
symfony: '5.4.*'
- description: Tests - Symfony 4.4 LTS
php: 7.4
symfony-version: '4.4.*'
symfony-version: '5.4.*'
deprecations: disabled
- description: Prefer lowest
dependencies: 'lowest'
php: 7.3
symfony-version: '4.4.*'
php: 7.4
symfony-version: '5.4.*'
deprecations: disabled
- description: Infection
php: 7.4
deprecations: disabled


env:
MONGO_HOST: localhost
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
SYMFONY_DEPRECATIONS_HELPER: ${{ matrix.deprecations }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -68,8 +69,6 @@ jobs:
- name: Run tests
if: matrix.description != 'Infection'
run: vendor/bin/phpunit --coverage-clover=build/coverage-report.xml
env:
SYMFONY_DEPRECATIONS_HELPER: ${{ matrix.deprecations }}
- name: Run mutation testing
if: matrix.description == 'Infection'
run: vendor/bin/infection --show-mutations --min-msi=84
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ lock-symfony-%:
docker-compose run --no-deps --rm php composer install --prefer-dist --no-interaction ${COMPOSER_FLAGS}

test-composer-install: lock-symfony-3.4 lock-symfony-4.4 lock-symfony-5.0 lock-symfony-6.0
test-composer-install: lock-symfony-5.4 lock-symfony-6.0 lock-symfony-7.0
Comment on lines 38 to +39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicated, it may not work correctly like this.


pre-commit-checks: cs-fix phpstan test infection
38 changes: 19 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,31 @@
}
],
"require": {
"php": "^7.3 || ^8.0",
"ext-mongodb": "^1.1.5",
"facile-it/mongodb-bundle": "^0.6 || ^1.0.0",
"mongodb/mongodb": "^1.1.0",
"php": "^7.4 || ^8.1",
"ext-mongodb": "^1.6",
"facile-it/mongodb-bundle": "^1.6",
"mongodb/mongodb": "^1.5",
"symfony/deprecation-contracts": "^2.1",
"symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0",
"symfony/messenger": "^4.4 || ^5.0 || ^6.0"
"symfony/framework-bundle": "^5.0 || ^6.0 || ^7.0",
"symfony/messenger": "^5.0 || ^6.0 || ^7.0"
Comment on lines +25 to +26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we dropping Symfony 4.4? If we do, we should bump up to 5.4, the other 5.x minors are not LTS.

},
"require-dev": {
"facile-it/facile-coding-standard": "^0.4.1",
"facile-it/facile-coding-standard": "^1.2.0",
"facile-it/symfony-functional-testcase": "^1.0",
"infection/infection": "^0.18",
"jangregor/phpstan-prophecy": "^0.8.0",
"infection/infection": "^0.23",
"jangregor/phpstan-prophecy": "^1.0",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.25",
"phpstan/phpstan-phpunit": "^0.12.8",
"phpunit/phpunit": "^9.5.2",
"symfony/browser-kit": "^4.4 || ^5.0 || ^6.0",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^9.6.13",
"symfony/browser-kit": "^5.0 || ^6.0 || ^7.0",
"symfony/flex": "^1.12",
"symfony/phpunit-bridge": "^5.2.4",
"symfony/property-access": "^4.4 || ^5.0 || ^6.0",
"symfony/property-info": "^4.4 || ^5.0 || ^6.0",
"symfony/serializer": "^4.4 || ^5.0 || ^6.0",
"symfony/yaml": "^4.4 || ^5.0 || ^6.0"
"symfony/phpunit-bridge": "7.0",
"symfony/property-access": "^5.0 || ^6.0 || ^7.0",
"symfony/property-info": "^5.0 || ^6.0 || ^7.0",
"symfony/serializer": "^5.0 || ^6.0 || ^7.0",
"symfony/yaml": "^5.0 || ^6.0 || ^7.0"
},
"minimum-stability": "stable",
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
depends_on:
- mongo
mongo:
image: mongo:3.4.2
image: mongo:4.4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we dropping support to Mongo below 4.4?

We need proper changelog details.

tmpfs:
- /data/db:uid=1001
environment:
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.3-alpine
FROM php:7.4-alpine

RUN apk --no-cache add \
$PHPIZE_DEPS \
Expand Down
22 changes: 21 additions & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,35 @@ parameters:
path: src/Transport/Connection.php

-
message: "#^Method Facile\\\\MongoDbMessenger\\\\Transport\\\\Connection\\:\\:findBy\\(\\) should return iterable\\<MongoDB\\\\Model\\\\BSONDocument\\>&MongoDB\\\\Driver\\\\Cursor but returns MongoDB\\\\Driver\\\\Cursor\\.$#"
message: "#^Method Facile\\\\MongoDbMessenger\\\\Transport\\\\Connection\\:\\:findBy\\(\\) should return iterable\\<MongoDB\\\\Model\\\\BSONDocument\\>&MongoDB\\\\Driver\\\\Cursor but returns Iterator&MongoDB\\\\Driver\\\\CursorInterface\\.$#"
count: 1
path: src/Transport/Connection.php

-
message: "#^Method Facile\\\\MongoDbMessenger\\\\Transport\\\\Connection\\:\\:send\\(\\) should return MongoDB\\\\BSON\\\\ObjectId but returns mixed\\.$#"
count: 1
path: src/Transport/Connection.php

-
message: "#^Method Facile\\\\MongoDbMessenger\\\\Transport\\\\TransportFactory\\:\\:buildConfiguration\\(\\) should return array\\{connection_name\\: string, collection_name\\: string, queue_name\\: string, redeliver_timeout\\: int, document_enhancers\\: array\\<string\\>, resettable\\: 0\\|1\\|bool\\} but returns non\\-empty\\-array\\<int\\|string, mixed\\>\\.$#"
count: 1
path: src/Transport/TransportFactory.php

-
message: "#^Parameter \\#1 \\$enhancer of method Facile\\\\MongoDbMessenger\\\\Transport\\\\Connection\\:\\:addDocumentEnhancer\\(\\) expects Facile\\\\MongoDbMessenger\\\\Extension\\\\DocumentEnhancer, object\\|null given\\.$#"
count: 1
path: src/Transport/TransportFactory.php

-
message: "#^Parameter \\#1 \\$enhancers of method Facile\\\\MongoDbMessenger\\\\Transport\\\\TransportFactory\\:\\:validateDocumentEnhancers\\(\\) expects array\\<string\\>, mixed given\\.$#"
count: 1
path: src/Transport/TransportFactory.php

-
message: "#^Property Facile\\\\MongoDbMessenger\\\\Tests\\\\Stubs\\\\InstantiableDocumentEnhancer\\:\\:\\$foo is never read, only written\\.$#"
count: 1
path: tests/Stubs/InstantiableDocumentEnhancer.php

-
message: "#^Constructor of class Facile\\\\MongoDbMessenger\\\\Tests\\\\Stubs\\\\NotInstantiableDocumentEnhancer has an unused parameter \\$bar\\.$#"
count: 1
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ parameters:
dynamicConstantNames:
- Symfony\Component\HttpKernel\Kernel::VERSION_ID
ignoreErrors:
- /no value type specified in iterable type MongoDB\\Model\\BSONDocument\./
- /^Access to an undefined property MongoDB\\Model\\BSONDocument::\$\w+\.$/
includes:
- phpstan-baseline.neon
4 changes: 2 additions & 2 deletions src/Transport/MongoDbUnresettableTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function all(int $limit = null): iterable
}

/**
* A method to obtain messages filtered in the same way as \MongoDB\Collection::find
* A method to obtain messages filtered in the same way as \MongoDB\Collection::find.
*
* @param array<string, mixed>|object $filters
* @param array<string, mixed> $options
Expand All @@ -81,7 +81,7 @@ public function findBy($filters = [], array $options = []): \Generator
}

/**
* A method to obtain a message count filtered in the same way as \MongoDB\Collection::count
* A method to obtain a message count filtered in the same way as \MongoDB\Collection::count.
*
* @param array<string, mixed>|object $filters
* @param array<string, mixed> $options
Expand Down
5 changes: 5 additions & 0 deletions src/Transport/TransportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ final class TransportFactory implements TransportFactoryInterface
];

public const CONNECTION_NAME = 'connection_name';

public const COLLECTION_NAME = 'collection_name';

public const QUEUE_NAME = 'queue_name';

public const REDELIVER_TIMEOUT = 'redeliver_timeout';

public const DOCUMENT_ENHANCERS = 'document_enhancers';

public const RESETTABLE = 'resettable';

/** @var ContainerInterface */
Expand Down
39 changes: 0 additions & 39 deletions tests/End2End/App/SuppressDeprecationNormalizer.php

This file was deleted.

4 changes: 2 additions & 2 deletions tests/End2End/App/json_serializer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ services:
- [
'@Symfony\Component\Serializer\Normalizer\ArrayDenormalizer',
'@Symfony\Component\Serializer\Normalizer\DateTimeNormalizer',
'@Facile\MongoDbMessenger\Tests\End2End\App\SuppressDeprecationNormalizer'
'@Symfony\Component\Serializer\Normalizer\ObjectNormalizer'
]
- ['@Symfony\Component\Serializer\Encoder\JsonEncoder']

Symfony\Component\Serializer\Normalizer\ArrayDenormalizer: ~
Symfony\Component\Serializer\Normalizer\DateTimeNormalizer: ~
Facile\MongoDbMessenger\Tests\End2End\App\SuppressDeprecationNormalizer: ~
Symfony\Component\Serializer\Normalizer\ObjectNormalizer: ~
Symfony\Component\Serializer\Encoder\JsonEncoder: ~
Comment on lines 10 to 20
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we dropped the specific normalizer, maybe we can drop the whole service definition? Or it's just temporary to see if we can solve the deprecations?


framework:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testEnhance(): void
}

$document = new BSONDocument();
$envelope = new Envelope(new class() {
$envelope = new Envelope(new class () {
}, $stamps);

(new FirstErrorMessageEnhancer())->enhance($document, $envelope);
Expand All @@ -45,7 +45,7 @@ public function testEnhance(): void
public function testEnhanceWithNoRedeliveryStamp(): void
{
$document = new BSONDocument();
$envelope = new Envelope(new class() {
$envelope = new Envelope(new class () {
});

(new FirstErrorMessageEnhancer())->enhance($document, $envelope);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testEnhance(): void
}

$document = new BSONDocument();
$envelope = new Envelope(new class() {
$envelope = new Envelope(new class () {
}, $stamps);

(new LastErrorMessageEnhancer())->enhance($document, $envelope);
Expand All @@ -45,7 +45,7 @@ public function testEnhance(): void
public function testEnhanceWithNoRedeliveryStamp(): void
{
$document = new BSONDocument();
$envelope = new Envelope(new class() {
$envelope = new Envelope(new class () {
});

(new LastErrorMessageEnhancer())->enhance($document, $envelope);
Expand Down
Loading