Skip to content
Open
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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ jobs:
php-version: ['8.1', '8.2', '8.3', '8.4']
name: PHP ${{ matrix.php-version }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: pcov
php-version: ${{ matrix.php-version }}
tools: pecl, composer:v2
extensions: mongodb-1.13
extensions: mongodb
- name: Composer config
run: composer config --no-plugins allow-plugins.infection/extension-installer true
- name: Composer install
run: composer install --no-interaction --no-progress --no-suggest
run: composer install --no-interaction --no-progress
- name: PHPUnit
run: ./vendor/bin/phpunit --coverage-clover coverage.xml
- name: PHPStan
Expand All @@ -30,7 +30,7 @@ jobs:
env:
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}
- name: Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
files: ./coverage.xml
55 changes: 55 additions & 0 deletions GEMINI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Project Overview

This project is a Symfony Bundle that provides a MongoDB transport for the Symfony Messenger component. It allows developers to use MongoDB as a message queue for their Symfony applications. This is particularly useful when an application already uses MongoDB and wants to avoid adding another dependency for a message queue.

The core of the bundle is the `MongoTransport` class, which implements the Symfony `TransportInterface`. This class handles the sending, receiving, acknowledging, and rejecting of messages using a MongoDB collection.

The project uses Composer for dependency management, PHPUnit for testing, Infection for mutation testing, and PHPStan for static analysis.

# Building and Running

## Dependencies

Install dependencies using Composer:

```bash
composer install
```

## Running Tests

Run the test suite using PHPUnit:

```bash
vendor/bin/phpunit
```

## Static Analysis

Run PHPStan for static analysis:

```bash
vendor/bin/phpstan analyse src tests
```

## Mutation Testing

Run Infection for mutation testing:

```bash
vendor/bin/infection
```

# Development Conventions

## Coding Style

The project follows the PSR-12 coding style guide.

## Testing

The project has a comprehensive test suite using PHPUnit. Tests are located in the `tests` directory and are separated into unit and integration tests.

## Contribution

Contributions are welcome. Please open an issue or create a pull request on the [GitHub repository](https://github.com/eMAGTechLabs/messenger-mongo-bundle).
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
"require": {
"php": "^8.1",
"ext-json": "*",
"ext-mongodb": "*",
"symfony/messenger": "^5.0 || ^6.0 || ^7.0",
"mongodb/mongodb": "^1.12"
"ext-mongodb": "^2.1",
"symfony/messenger": "^6.0 || ^7.0",
"mongodb/mongodb": "^2.1"
},
"require-dev": {
"symfony/serializer": "^5.0 || ^6.0 || ^7.0",
"symfony/property-access": "^5.0 || ^6.0 || ^7.0",
"symfony/var-dumper": "^5.0 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^5.0 || ^6.0 || ^7.0",
"symfony/serializer": "^6.0 || ^7.0",
"symfony/property-access": "^6.0 || ^7.0",
"symfony/var-dumper": "^6.0 || ^7.0",
"symfony/framework-bundle": "^6.0 || ^7.0",
"phpunit/phpunit": "^10.5",
"infection/infection": "^0.27.9",
"phpstan/phpstan": "^1.10"
"phpstan/phpstan": "^2.1"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 0 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.6'
services:
php:
build:
Expand All @@ -14,5 +13,3 @@ services:
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=rootpass


6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.3-alpine
FROM php:8.4-alpine

WORKDIR /var/www/html

Expand All @@ -7,7 +7,7 @@ RUN apk update \
&& apk add --no-cache git zip make autoconf g++ openssl-dev linux-headers \
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS

RUN pecl -q install mongodb-1.17.2 \
RUN pecl -q install mongodb-2.1.4 \
&& docker-php-ext-enable mongodb \
&& pecl -q install xdebug \
&& docker-php-ext-enable xdebug
Expand All @@ -18,4 +18,4 @@ RUN curl --silent --show-error https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
&& chmod o+x /usr/local/bin/composer

ENTRYPOINT ["tail", "-f", "/dev/null"]
ENTRYPOINT ["tail", "-f", "/dev/null"]
3 changes: 0 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
parameters:
level: 5
checkMissingIterableValueType: false
paths:
- src
- tests
ignoreErrors:
- '#Access to an undefined property MongoDB\\Collection::\$documents.#'
5 changes: 2 additions & 3 deletions src/MongoTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
public function get(): iterable
{
$now = new DateTime();
$redeliverLimit = (clone $now)->modify(sprintf(

Check warning on line 47 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.2

Escaped Mutant for Mutator "CloneRemoval": --- Original +++ New @@ @@ public function get() : iterable { $now = new DateTime(); - $redeliverLimit = (clone $now)->modify(sprintf('-%d seconds', $this->options['redeliver_timeout'])); + $redeliverLimit = $now->modify(sprintf('-%d seconds', $this->options['redeliver_timeout'])); $options = ['sort' => ['available_at' => 1], 'returnDocument' => FindOneAndUpdate::RETURN_DOCUMENT_AFTER]; if ($this->options['enable_writeConcern_majority']) { $options['writeConcern'] = new WriteConcern(WriteConcern::MAJORITY);

Check warning on line 47 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.3

Escaped Mutant for Mutator "CloneRemoval": --- Original +++ New @@ @@ public function get() : iterable { $now = new DateTime(); - $redeliverLimit = (clone $now)->modify(sprintf('-%d seconds', $this->options['redeliver_timeout'])); + $redeliverLimit = $now->modify(sprintf('-%d seconds', $this->options['redeliver_timeout'])); $options = ['sort' => ['available_at' => 1], 'returnDocument' => FindOneAndUpdate::RETURN_DOCUMENT_AFTER]; if ($this->options['enable_writeConcern_majority']) { $options['writeConcern'] = new WriteConcern(WriteConcern::MAJORITY);

Check warning on line 47 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.4

Escaped Mutant for Mutator "CloneRemoval": --- Original +++ New @@ @@ public function get() : iterable { $now = new DateTime(); - $redeliverLimit = (clone $now)->modify(sprintf('-%d seconds', $this->options['redeliver_timeout'])); + $redeliverLimit = $now->modify(sprintf('-%d seconds', $this->options['redeliver_timeout'])); $options = ['sort' => ['available_at' => 1], 'returnDocument' => FindOneAndUpdate::RETURN_DOCUMENT_AFTER]; if ($this->options['enable_writeConcern_majority']) { $options['writeConcern'] = new WriteConcern(WriteConcern::MAJORITY);

Check warning on line 47 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

Escaped Mutant for Mutator "CloneRemoval": --- Original +++ New @@ @@ public function get() : iterable { $now = new DateTime(); - $redeliverLimit = (clone $now)->modify(sprintf('-%d seconds', $this->options['redeliver_timeout'])); + $redeliverLimit = $now->modify(sprintf('-%d seconds', $this->options['redeliver_timeout'])); $options = ['sort' => ['available_at' => 1], 'returnDocument' => FindOneAndUpdate::RETURN_DOCUMENT_AFTER]; if ($this->options['enable_writeConcern_majority']) { $options['writeConcern'] = new WriteConcern(WriteConcern::MAJORITY);
'-%d seconds',
$this->options['redeliver_timeout']
));
Expand Down Expand Up @@ -102,10 +102,9 @@
*/
private function removeMessage(Envelope $envelope): void
{
/** @var TransportMessageIdStamp $transportMessageIdStamp */
$transportMessageIdStamp = $envelope->last(TransportMessageIdStamp::class);

if (!$transportMessageIdStamp instanceof TransportMessageIdStamp) {

Check warning on line 107 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.2

Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ private function removeMessage(Envelope $envelope) : void { $transportMessageIdStamp = $envelope->last(TransportMessageIdStamp::class); - if (!$transportMessageIdStamp instanceof TransportMessageIdStamp) { + if (!true) { throw new LogicException(sprintf('No "%s" found on the Envelope.', TransportMessageIdStamp::class)); } $id = $transportMessageIdStamp->getId();

Check warning on line 107 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.3

Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ private function removeMessage(Envelope $envelope) : void { $transportMessageIdStamp = $envelope->last(TransportMessageIdStamp::class); - if (!$transportMessageIdStamp instanceof TransportMessageIdStamp) { + if (!true) { throw new LogicException(sprintf('No "%s" found on the Envelope.', TransportMessageIdStamp::class)); } $id = $transportMessageIdStamp->getId();

Check warning on line 107 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.4

Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ private function removeMessage(Envelope $envelope) : void { $transportMessageIdStamp = $envelope->last(TransportMessageIdStamp::class); - if (!$transportMessageIdStamp instanceof TransportMessageIdStamp) { + if (!true) { throw new LogicException(sprintf('No "%s" found on the Envelope.', TransportMessageIdStamp::class)); } $id = $transportMessageIdStamp->getId();

Check warning on line 107 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ private function removeMessage(Envelope $envelope) : void { $transportMessageIdStamp = $envelope->last(TransportMessageIdStamp::class); - if (!$transportMessageIdStamp instanceof TransportMessageIdStamp) { + if (!true) { throw new LogicException(sprintf('No "%s" found on the Envelope.', TransportMessageIdStamp::class)); } $id = $transportMessageIdStamp->getId();
throw new LogicException(sprintf('No "%s" found on the Envelope.', TransportMessageIdStamp::class));
}

Expand Down Expand Up @@ -141,10 +140,10 @@
$encodedMessage = $this->serializer->encode($envelope);

$delayStamp = $envelope->last(DelayStamp::class);
$delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0;

Check warning on line 143 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.2

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ { $encodedMessage = $this->serializer->encode($envelope); $delayStamp = $envelope->last(DelayStamp::class); - $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; + $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 1; $now = new DateTime(); $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); $objectId = new ObjectId();

Check warning on line 143 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.2

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ { $encodedMessage = $this->serializer->encode($envelope); $delayStamp = $envelope->last(DelayStamp::class); - $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; + $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : -1; $now = new DateTime(); $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); $objectId = new ObjectId();

Check warning on line 143 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.3

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ { $encodedMessage = $this->serializer->encode($envelope); $delayStamp = $envelope->last(DelayStamp::class); - $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; + $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 1; $now = new DateTime(); $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); $objectId = new ObjectId();

Check warning on line 143 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.3

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ { $encodedMessage = $this->serializer->encode($envelope); $delayStamp = $envelope->last(DelayStamp::class); - $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; + $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : -1; $now = new DateTime(); $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); $objectId = new ObjectId();

Check warning on line 143 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.4

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ { $encodedMessage = $this->serializer->encode($envelope); $delayStamp = $envelope->last(DelayStamp::class); - $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; + $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 1; $now = new DateTime(); $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); $objectId = new ObjectId();

Check warning on line 143 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.4

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ { $encodedMessage = $this->serializer->encode($envelope); $delayStamp = $envelope->last(DelayStamp::class); - $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; + $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : -1; $now = new DateTime(); $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); $objectId = new ObjectId();

Check warning on line 143 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ { $encodedMessage = $this->serializer->encode($envelope); $delayStamp = $envelope->last(DelayStamp::class); - $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; + $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 1; $now = new DateTime(); $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); $objectId = new ObjectId();

Check warning on line 143 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ { $encodedMessage = $this->serializer->encode($envelope); $delayStamp = $envelope->last(DelayStamp::class); - $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; + $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : -1; $now = new DateTime(); $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); $objectId = new ObjectId();

$now = new DateTime();
$availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000));

Check warning on line 146 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.2

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ $delayStamp = $envelope->last(DelayStamp::class); $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; $now = new DateTime(); - $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); + $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1001)); $objectId = new ObjectId(); $data = ['_id' => $objectId, 'body' => $encodedMessage['body'], 'headers' => json_encode($encodedMessage['headers'] ?? []), 'queue_name' => $this->options['queue'], 'created_at' => new UTCDateTime($now), 'available_at' => new UTCDateTime($availableAt)]; $this->collection->insertOne($data);

Check warning on line 146 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.2

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ $delayStamp = $envelope->last(DelayStamp::class); $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; $now = new DateTime(); - $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); + $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 999)); $objectId = new ObjectId(); $data = ['_id' => $objectId, 'body' => $encodedMessage['body'], 'headers' => json_encode($encodedMessage['headers'] ?? []), 'queue_name' => $this->options['queue'], 'created_at' => new UTCDateTime($now), 'available_at' => new UTCDateTime($availableAt)]; $this->collection->insertOne($data);

Check warning on line 146 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.3

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ $delayStamp = $envelope->last(DelayStamp::class); $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; $now = new DateTime(); - $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); + $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1001)); $objectId = new ObjectId(); $data = ['_id' => $objectId, 'body' => $encodedMessage['body'], 'headers' => json_encode($encodedMessage['headers'] ?? []), 'queue_name' => $this->options['queue'], 'created_at' => new UTCDateTime($now), 'available_at' => new UTCDateTime($availableAt)]; $this->collection->insertOne($data);

Check warning on line 146 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.3

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ $delayStamp = $envelope->last(DelayStamp::class); $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; $now = new DateTime(); - $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); + $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 999)); $objectId = new ObjectId(); $data = ['_id' => $objectId, 'body' => $encodedMessage['body'], 'headers' => json_encode($encodedMessage['headers'] ?? []), 'queue_name' => $this->options['queue'], 'created_at' => new UTCDateTime($now), 'available_at' => new UTCDateTime($availableAt)]; $this->collection->insertOne($data);

Check warning on line 146 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.4

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ $delayStamp = $envelope->last(DelayStamp::class); $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; $now = new DateTime(); - $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); + $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1001)); $objectId = new ObjectId(); $data = ['_id' => $objectId, 'body' => $encodedMessage['body'], 'headers' => json_encode($encodedMessage['headers'] ?? []), 'queue_name' => $this->options['queue'], 'created_at' => new UTCDateTime($now), 'available_at' => new UTCDateTime($availableAt)]; $this->collection->insertOne($data);

Check warning on line 146 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.4

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ $delayStamp = $envelope->last(DelayStamp::class); $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; $now = new DateTime(); - $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); + $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 999)); $objectId = new ObjectId(); $data = ['_id' => $objectId, 'body' => $encodedMessage['body'], 'headers' => json_encode($encodedMessage['headers'] ?? []), 'queue_name' => $this->options['queue'], 'created_at' => new UTCDateTime($now), 'available_at' => new UTCDateTime($availableAt)]; $this->collection->insertOne($data);

Check warning on line 146 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ $delayStamp = $envelope->last(DelayStamp::class); $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; $now = new DateTime(); - $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); + $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1001)); $objectId = new ObjectId(); $data = ['_id' => $objectId, 'body' => $encodedMessage['body'], 'headers' => json_encode($encodedMessage['headers'] ?? []), 'queue_name' => $this->options['queue'], 'created_at' => new UTCDateTime($now), 'available_at' => new UTCDateTime($availableAt)]; $this->collection->insertOne($data);

Check warning on line 146 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ $delayStamp = $envelope->last(DelayStamp::class); $delay = $delayStamp instanceof DelayStamp ? $delayStamp->getDelay() : 0; $now = new DateTime(); - $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 1000)); + $availableAt = (clone $now)->modify(sprintf('+%d seconds', $delay / 999)); $objectId = new ObjectId(); $data = ['_id' => $objectId, 'body' => $encodedMessage['body'], 'headers' => json_encode($encodedMessage['headers'] ?? []), 'queue_name' => $this->options['queue'], 'created_at' => new UTCDateTime($now), 'available_at' => new UTCDateTime($availableAt)]; $this->collection->insertOne($data);

$objectId = new ObjectId();
$data = [
Expand All @@ -161,18 +160,18 @@
return $envelope->with(new TransportMessageIdStamp($objectId));
}

public function all(int $limit = null): iterable
public function all(?int $limit = null): iterable
{
$documents = $this->collection->find([], ['limit' => $limit]);

Check warning on line 165 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.2

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } public function all(?int $limit = null) : iterable { - $documents = $this->collection->find([], ['limit' => $limit]); + $documents = $this->collection->find([], []); foreach ($documents as $document) { (yield $this->createEnvelopeFromDocument($document)); }

Check warning on line 165 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.3

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } public function all(?int $limit = null) : iterable { - $documents = $this->collection->find([], ['limit' => $limit]); + $documents = $this->collection->find([], []); foreach ($documents as $document) { (yield $this->createEnvelopeFromDocument($document)); }

Check warning on line 165 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.4

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } public function all(?int $limit = null) : iterable { - $documents = $this->collection->find([], ['limit' => $limit]); + $documents = $this->collection->find([], []); foreach ($documents as $document) { (yield $this->createEnvelopeFromDocument($document)); }

Check warning on line 165 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } public function all(?int $limit = null) : iterable { - $documents = $this->collection->find([], ['limit' => $limit]); + $documents = $this->collection->find([], []); foreach ($documents as $document) { (yield $this->createEnvelopeFromDocument($document)); }

foreach ($documents as $document) {
yield $this->createEnvelopeFromDocument($document);
}
}

public function find($id): ?Envelope
public function find(mixed $id): ?Envelope
{
$document = $this->collection->findOne(['_id' => is_string($id) ? new ObjectId($id) : $id]);

Check warning on line 174 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.2

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } public function find(mixed $id) : ?Envelope { - $document = $this->collection->findOne(['_id' => is_string($id) ? new ObjectId($id) : $id]); + $document = $this->collection->findOne([]); if (null === $document) { return null; }

Check warning on line 174 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.2

Escaped Mutant for Mutator "Ternary": --- Original +++ New @@ @@ } public function find(mixed $id) : ?Envelope { - $document = $this->collection->findOne(['_id' => is_string($id) ? new ObjectId($id) : $id]); + $document = $this->collection->findOne(['_id' => is_string($id) ? $id : new ObjectId($id)]); if (null === $document) { return null; }

Check warning on line 174 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.3

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } public function find(mixed $id) : ?Envelope { - $document = $this->collection->findOne(['_id' => is_string($id) ? new ObjectId($id) : $id]); + $document = $this->collection->findOne([]); if (null === $document) { return null; }

Check warning on line 174 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.3

Escaped Mutant for Mutator "Ternary": --- Original +++ New @@ @@ } public function find(mixed $id) : ?Envelope { - $document = $this->collection->findOne(['_id' => is_string($id) ? new ObjectId($id) : $id]); + $document = $this->collection->findOne(['_id' => is_string($id) ? $id : new ObjectId($id)]); if (null === $document) { return null; }

Check warning on line 174 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.4

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } public function find(mixed $id) : ?Envelope { - $document = $this->collection->findOne(['_id' => is_string($id) ? new ObjectId($id) : $id]); + $document = $this->collection->findOne([]); if (null === $document) { return null; }

Check warning on line 174 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.4

Escaped Mutant for Mutator "Ternary": --- Original +++ New @@ @@ } public function find(mixed $id) : ?Envelope { - $document = $this->collection->findOne(['_id' => is_string($id) ? new ObjectId($id) : $id]); + $document = $this->collection->findOne(['_id' => is_string($id) ? $id : new ObjectId($id)]); if (null === $document) { return null; }

Check warning on line 174 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } public function find(mixed $id) : ?Envelope { - $document = $this->collection->findOne(['_id' => is_string($id) ? new ObjectId($id) : $id]); + $document = $this->collection->findOne([]); if (null === $document) { return null; }

Check warning on line 174 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

Escaped Mutant for Mutator "Ternary": --- Original +++ New @@ @@ } public function find(mixed $id) : ?Envelope { - $document = $this->collection->findOne(['_id' => is_string($id) ? new ObjectId($id) : $id]); + $document = $this->collection->findOne(['_id' => is_string($id) ? $id : new ObjectId($id)]); if (null === $document) { return null; }

if (null === $document) {
return null;
Expand Down Expand Up @@ -200,7 +199,7 @@
);

return $envelope->with(
new TransportMessageIdStamp((string)$document['_id'])

Check warning on line 202 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.2

Escaped Mutant for Mutator "CastString": --- Original +++ New @@ @@ $headers = json_decode($headers, true) ?: $headers; } $envelope = $this->serializer->decode(['body' => $document['body'], 'headers' => $headers]); - return $envelope->with(new TransportMessageIdStamp((string) $document['_id'])); + return $envelope->with(new TransportMessageIdStamp($document['_id'])); } public function getMessageCount() : int {

Check warning on line 202 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.3

Escaped Mutant for Mutator "CastString": --- Original +++ New @@ @@ $headers = json_decode($headers, true) ?: $headers; } $envelope = $this->serializer->decode(['body' => $document['body'], 'headers' => $headers]); - return $envelope->with(new TransportMessageIdStamp((string) $document['_id'])); + return $envelope->with(new TransportMessageIdStamp($document['_id'])); } public function getMessageCount() : int {

Check warning on line 202 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.4

Escaped Mutant for Mutator "CastString": --- Original +++ New @@ @@ $headers = json_decode($headers, true) ?: $headers; } $envelope = $this->serializer->decode(['body' => $document['body'], 'headers' => $headers]); - return $envelope->with(new TransportMessageIdStamp((string) $document['_id'])); + return $envelope->with(new TransportMessageIdStamp($document['_id'])); } public function getMessageCount() : int {

Check warning on line 202 in src/MongoTransport.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

Escaped Mutant for Mutator "CastString": --- Original +++ New @@ @@ $headers = json_decode($headers, true) ?: $headers; } $envelope = $this->serializer->decode(['body' => $document['body'], 'headers' => $headers]); - return $envelope->with(new TransportMessageIdStamp((string) $document['_id'])); + return $envelope->with(new TransportMessageIdStamp($document['_id'])); } public function getMessageCount() : int {
);
}

Expand Down
Loading