Skip to content

Commit 3aa5e0d

Browse files
authored
Update FindAndModifyCommandSubscriber.php
Using $model::firstOrCreate(...) currently results in deprecation warnings. Can be addressed by adding `void` return type. Warnings: ``` DEPRECATED Return type of MongoDB\Laravel\Internal\FindAndModifyCommandSubscriber::commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) should either be compatible with MongoDB\Driver\Monitoring\CommandSubscriber::commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in vendor/mongodb/laravel-mongodb/src/Internal/FindAndModifyCommandSubscriber.php on line 26. DEPRECATED Return type of MongoDB\Laravel\Internal\FindAndModifyCommandSubscriber::commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) should either be compatible with MongoDB\Driver\Monitoring\CommandSubscriber::commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in vendor/mongodb/laravel-mongodb/src/Internal/FindAndModifyCommandSubscriber.php on line 30. DEPRECATED Return type of MongoDB\Laravel\Internal\FindAndModifyCommandSubscriber::commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) should either be compatible with MongoDB\Driver\Monitoring\CommandSubscriber::commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in vendor/mongodb/laravel-mongodb/src/Internal/FindAndModifyCommandSubscriber.php on line 22. ```
1 parent a72d181 commit 3aa5e0d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Internal/FindAndModifyCommandSubscriber.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ final class FindAndModifyCommandSubscriber implements CommandSubscriber
1919
{
2020
public bool $created;
2121

22-
public function commandFailed(CommandFailedEvent $event)
22+
public function commandFailed(CommandFailedEvent $event): void
2323
{
2424
}
2525

26-
public function commandStarted(CommandStartedEvent $event)
26+
public function commandStarted(CommandStartedEvent $event): void
2727
{
2828
}
2929

30-
public function commandSucceeded(CommandSucceededEvent $event)
30+
public function commandSucceeded(CommandSucceededEvent $event): void
3131
{
3232
$this->created = ! $event->getReply()->lastErrorObject->updatedExisting;
3333
}

0 commit comments

Comments
 (0)