Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dd246bd

Browse files
committed
Resolve conflicts in 5.x
* 5.x: DOCSP-51402: schema-flexible terminology (#3424) PHPORM-361 Remove autocommit of CS fixes (#3420) PHPORM-146: Add override attribute everywhere (#3412)
2 parents 15ead8f + a2b4ab8 commit dd246bd

25 files changed

+218
-87
lines changed

‎.github/workflows/coding-standards.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,6 @@ jobs:
6464

6565
# The -q option is required until phpcs v4 is released
6666
- name: "Run PHP_CodeSniffer"
67-
run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr"
67+
run: |
68+
mkdir .cache
69+
vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr

‎docs/database-collection.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ methods in your application:
213213

214214
.. note::
215215

216-
MongoDB is a schemaless database, so the preceding schema builder methods
217-
query the database data rather than the schema.
216+
MongoDB is a schema-flexible database, so the preceding schema
217+
builder methods query the database data rather than the schema.
218218

219219
Example
220220
```````
@@ -269,9 +269,10 @@ collection fields:
269269
- ``Schema::hasColumns(string $<collection>, string[] $<field names>)``:
270270
checks if each specified field exists in at least one document
271271

272-
MongoDB is a schemaless database, so the preceding methods query the collection
273-
data rather than the database schema. If the specified collection doesn't exist
274-
or is empty, these methods return a value of ``false``.
272+
MongoDB is a schema-flexible database, so the preceding methods query
273+
the collection data rather than the database schema. If the specified
274+
collection doesn't exist or is empty, these methods return a value of
275+
``false``.
275276

276277
.. note:: id Alias
277278

‎docs/feature-compatibility.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Migration Features
201201
------------------
202202

203203
The {+odm-short+} supports all Laravel migration features, but the
204-
implementation is specific to MongoDB's schemaless model.
204+
implementation is specific to MongoDB's schema-flexible model.
205205

206206
Seeding Features
207207
----------------

‎src/Bus/MongoBatchRepository.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ public function prune(DateTimeInterface $before): int
216216
}
217217

218218
/** Prune all the unfinished entries older than the given date. */
219+
#[Override]
219220
public function pruneUnfinished(DateTimeInterface $before): int
220221
{
221222
$result = $this->collection->deleteMany(
@@ -229,6 +230,7 @@ public function pruneUnfinished(DateTimeInterface $before): int
229230
}
230231

231232
/** Prune all the cancelled entries older than the given date. */
233+
#[Override]
232234
public function pruneCancelled(DateTimeInterface $before): int
233235
{
234236
$result = $this->collection->deleteMany(

‎src/Cache/MongoLock.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function __construct(
4141
/**
4242
* Attempt to acquire the lock.
4343
*/
44+
#[Override]
4445
public function acquire(): bool
4546
{
4647
// The lock can be acquired if: it doesn't exist, it has expired,

‎src/CommandSubscriber.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use MongoDB\Driver\Monitoring\CommandStartedEvent;
88
use MongoDB\Driver\Monitoring\CommandSubscriber as CommandSubscriberInterface;
99
use MongoDB\Driver\Monitoring\CommandSucceededEvent;
10+
use Override;
1011

1112
use function get_object_vars;
1213
use function in_array;
@@ -21,16 +22,19 @@ public function __construct(private Connection $connection)
2122
{
2223
}
2324

25+
#[Override]
2426
public function commandStarted(CommandStartedEvent $event): void
2527
{
2628
$this->commands[$event->getOperationId()] = $event;
2729
}
2830

31+
#[Override]
2932
public function commandFailed(CommandFailedEvent $event): void
3033
{
3134
$this->logQuery($event);
3235
}
3336

37+
#[Override]
3438
public function commandSucceeded(CommandSucceededEvent $event): void
3539
{
3640
$this->logQuery($event);

‎src/Connection.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use MongoDB\Driver\ReadPreference;
1717
use MongoDB\Laravel\Concerns\ManagesTransactions;
1818
use OutOfBoundsException;
19+
use Override;
1920
use Throwable;
2021

2122
use function filter_var;
@@ -95,6 +96,7 @@ public function __construct(array $config)
9596
*
9697
* @return Query\Builder
9798
*/
99+
#[Override]
98100
public function table($table, $as = null)
99101
{
100102
$query = new Query\Builder($this, $this->getQueryGrammar(), $this->getPostProcessor());
@@ -115,6 +117,7 @@ public function getCollection($name): Collection
115117
}
116118

117119
/** @inheritdoc */
120+
#[Override]
118121
public function getSchemaBuilder()
119122
{
120123
return new Schema\Builder($this);
@@ -172,6 +175,8 @@ public function getClient(): ?Client
172175
return $this->connection;
173176
}
174177

178+
/** @inheritdoc */
179+
#[Override]
175180
public function enableQueryLog()
176181
{
177182
parent::enableQueryLog();
@@ -182,6 +187,7 @@ public function enableQueryLog()
182187
}
183188
}
184189

190+
#[Override]
185191
public function disableQueryLog()
186192
{
187193
parent::disableQueryLog();
@@ -192,6 +198,7 @@ public function disableQueryLog()
192198
}
193199
}
194200

201+
#[Override]
195202
protected function withFreshQueryLog($callback)
196203
{
197204
try {
@@ -340,6 +347,7 @@ protected function getDsn(array $config): string
340347
}
341348

342349
/** @inheritdoc */
350+
#[Override]
343351
public function getDriverName()
344352
{
345353
return 'mongodb';
@@ -352,19 +360,22 @@ public function getDriverTitle()
352360
}
353361

354362
/** @inheritdoc */
363+
#[Override]
355364
protected function getDefaultPostProcessor()
356365
{
357366
return new Query\Processor();
358367
}
359368

360369
/** @inheritdoc */
370+
#[Override]
361371
protected function getDefaultQueryGrammar()
362372
{
363373
// Argument added in Laravel 12
364374
return new Query\Grammar($this);
365375
}
366376

367377
/** @inheritdoc */
378+
#[Override]
368379
protected function getDefaultSchemaGrammar()
369380
{
370381
// Argument added in Laravel 12

‎src/Eloquent/Builder.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use MongoDB\Laravel\Helpers\QueriesRelationships;
1919
use MongoDB\Laravel\Query\AggregationBuilder;
2020
use MongoDB\Model\BSONDocument;
21+
use Override;
2122

2223
use function array_key_exists;
2324
use function array_map;
@@ -127,7 +128,12 @@ public function vectorSearch(
127128
return $this->model->hydrate($results->all());
128129
}
129130

130-
/** @inheritdoc */
131+
/**
132+
* @param array $options
133+
*
134+
* @inheritdoc
135+
*/
136+
#[Override]
131137
public function update(array $values, array $options = [])
132138
{
133139
// Intercept operations on embedded models and delegate logic
@@ -270,6 +276,7 @@ public function raw($value = null)
270276
return $results;
271277
}
272278

279+
#[Override]
273280
public function firstOrCreate(array $attributes = [], array $values = [])
274281
{
275282
$instance = (clone $this)->where($attributes)->first();
@@ -285,6 +292,7 @@ public function firstOrCreate(array $attributes = [], array $values = [])
285292
return $this->createOrFirst($attributes, $values);
286293
}
287294

295+
#[Override]
288296
public function createOrFirst(array $attributes = [], array $values = [])
289297
{
290298
// The duplicate key error would abort the transaction. Using the regular firstOrCreate in that case.
@@ -308,9 +316,8 @@ public function createOrFirst(array $attributes = [], array $values = [])
308316
* TODO Remove if https://github.com/laravel/framework/commit/6484744326531829341e1ff886cc9b628b20d73e
309317
* will be reverted
310318
* Issue in laravel/frawework https://github.com/laravel/framework/issues/27791.
311-
*
312-
* @return array
313319
*/
320+
#[Override]
314321
protected function addUpdatedAtColumn(array $values)
315322
{
316323
if (! $this->model->usesTimestamps() || $this->model->getUpdatedAtColumn() === null) {
@@ -332,6 +339,7 @@ public function getConnection(): Connection
332339
}
333340

334341
/** @inheritdoc */
342+
#[Override]
335343
protected function ensureOrderForCursorPagination($shouldReverse = false)
336344
{
337345
if (empty($this->query->orders)) {

‎src/MongoDBBusServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Illuminate\Support\ServiceProvider;
1111
use InvalidArgumentException;
1212
use MongoDB\Laravel\Bus\MongoBatchRepository;
13+
use Override;
1314

1415
use function sprintf;
1516

@@ -18,6 +19,7 @@ class MongoDBBusServiceProvider extends ServiceProvider implements DeferrablePro
1819
/**
1920
* Register the service provider.
2021
*/
22+
#[Override]
2123
public function register()
2224
{
2325
$this->app->singleton(MongoBatchRepository::class, function (Container $app) {
@@ -46,6 +48,8 @@ public function register()
4648
});
4749
}
4850

51+
/** @inheritdoc */
52+
#[Override]
4953
public function provides()
5054
{
5155
return [

‎src/MongoDBServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use MongoDB\Laravel\Queue\MongoConnector;
2525
use MongoDB\Laravel\Scout\ScoutEngine;
2626
use MongoDB\Laravel\Session\MongoDbSessionHandler;
27+
use Override;
2728
use RuntimeException;
2829

2930
use function assert;
@@ -47,6 +48,7 @@ public function boot()
4748
/**
4849
* Register the service provider.
4950
*/
51+
#[Override]
5052
public function register()
5153
{
5254
// Add database driver.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /