Skip to content

Commit a699f26

Browse files
committed
Add #[Override] attributes to Query\Builder
to keep track of the methods we're overriding on the base builder
1 parent aad17bb commit a699f26

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/Query/Builder.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,14 @@ public function hint($index)
243243
}
244244

245245
/** @inheritdoc */
246+
#[Override]
246247
public function find($id, $columns = [])
247248
{
248249
return $this->where('_id', '=', $this->convertKey($id))->first($columns);
249250
}
250251

251252
/** @inheritdoc */
253+
#[Override]
252254
public function value($column)
253255
{
254256
$result = (array) $this->first([$column]);
@@ -257,12 +259,14 @@ public function value($column)
257259
}
258260

259261
/** @inheritdoc */
262+
#[Override]
260263
public function get($columns = [])
261264
{
262265
return $this->getFresh($columns);
263266
}
264267

265268
/** @inheritdoc */
269+
#[Override]
266270
public function cursor($columns = [])
267271
{
268272
$result = $this->getFresh($columns, true);
@@ -579,6 +583,7 @@ public function generateCacheKey()
579583
}
580584

581585
/** @return ($function is null ? AggregationBuilder : mixed) */
586+
#[Override]
582587
public function aggregate($function = null, $columns = ['*'])
583588
{
584589
assert(is_array($columns), new TypeError(sprintf('Argument #2 ($columns) must be of type array, %s given', get_debug_type($columns))));
@@ -654,6 +659,7 @@ public function aggregateByGroup(string $function, array $columns = ['*'])
654659
}
655660

656661
/** @inheritdoc */
662+
#[Override]
657663
public function exists()
658664
{
659665
return $this->first(['id']) !== null;
@@ -676,6 +682,7 @@ public function distinct($column = false)
676682
*
677683
* @inheritdoc
678684
*/
685+
#[Override]
679686
public function orderBy($column, $direction = 'asc')
680687
{
681688
if (is_string($direction)) {
@@ -697,6 +704,7 @@ public function orderBy($column, $direction = 'asc')
697704
}
698705

699706
/** @inheritdoc */
707+
#[Override]
700708
public function whereBetween($column, iterable $values, $boolean = 'and', $not = false)
701709
{
702710
$type = 'between';
@@ -721,6 +729,7 @@ public function whereBetween($column, iterable $values, $boolean = 'and', $not =
721729
}
722730

723731
/** @inheritdoc */
732+
#[Override]
724733
public function insert(array $values)
725734
{
726735
// Allow empty insert batch for consistency with Eloquent SQL
@@ -755,6 +764,7 @@ public function insert(array $values)
755764
}
756765

757766
/** @inheritdoc */
767+
#[Override]
758768
public function insertGetId(array $values, $sequence = null)
759769
{
760770
$options = $this->inheritConnectionOptions();
@@ -774,6 +784,7 @@ public function insertGetId(array $values, $sequence = null)
774784
}
775785

776786
/** @inheritdoc */
787+
#[Override]
777788
public function update(array $values, array $options = [])
778789
{
779790
// Use $set as default operator for field names that are not in an operator
@@ -790,6 +801,7 @@ public function update(array $values, array $options = [])
790801
}
791802

792803
/** @inheritdoc */
804+
#[Override]
793805
public function upsert(array $values, $uniqueBy, $update = null): int
794806
{
795807
if ($values === []) {
@@ -836,6 +848,7 @@ public function upsert(array $values, $uniqueBy, $update = null): int
836848
}
837849

838850
/** @inheritdoc */
851+
#[Override]
839852
public function increment($column, $amount = 1, array $extra = [], array $options = [])
840853
{
841854
$query = ['$inc' => [(string) $column => $amount]];
@@ -856,6 +869,7 @@ public function increment($column, $amount = 1, array $extra = [], array $option
856869
return $this->performUpdate($query, $options);
857870
}
858871

872+
#[Override]
859873
public function incrementEach(array $columns, array $extra = [], array $options = [])
860874
{
861875
$stage['$addFields'] = $extra;
@@ -873,12 +887,14 @@ public function incrementEach(array $columns, array $extra = [], array $options
873887
}
874888

875889
/** @inheritdoc */
890+
#[Override]
876891
public function decrement($column, $amount = 1, array $extra = [], array $options = [])
877892
{
878893
return $this->increment($column, -1 * $amount, $extra, $options);
879894
}
880895

881896
/** @inheritdoc */
897+
#[Override]
882898
public function decrementEach(array $columns, array $extra = [], array $options = [])
883899
{
884900
$decrement = [];
@@ -932,6 +948,7 @@ public function divide($column, $amount, array $extra = [], array $options = [])
932948
}
933949

934950
/** @inheritdoc */
951+
#[Override]
935952
public function pluck($column, $key = null)
936953
{
937954
$results = $this->get($key === null ? [$column] : [$column, $key]);
@@ -942,6 +959,7 @@ public function pluck($column, $key = null)
942959
}
943960

944961
/** @inheritdoc */
962+
#[Override]
945963
public function delete($id = null)
946964
{
947965
// If an ID is passed to the method, we will set the where clause to check
@@ -973,6 +991,7 @@ public function delete($id = null)
973991
}
974992

975993
/** @inheritdoc */
994+
#[Override]
976995
public function from($collection, $as = null)
977996
{
978997
if ($collection) {
@@ -1012,6 +1031,7 @@ public function lists($column, $key = null)
10121031
*
10131032
* @template T
10141033
*/
1034+
#[Override]
10151035
public function raw($value = null)
10161036
{
10171037
// Execute the closure on the mongodb collection
@@ -1114,11 +1134,13 @@ public function drop($columns)
11141134
*
11151135
* @inheritdoc
11161136
*/
1137+
#[Override]
11171138
public function newQuery()
11181139
{
11191140
return new static($this->connection, $this->grammar, $this->processor);
11201141
}
11211142

1143+
#[Override]
11221144
public function runPaginationCountQuery($columns = ['*'])
11231145
{
11241146
if ($this->distinct) {
@@ -1201,6 +1223,7 @@ public function convertKey($id)
12011223
*
12021224
* @return $this
12031225
*/
1226+
#[Override]
12041227
public function where($column, $operator = null, $value = null, $boolean = 'and')
12051228
{
12061229
$params = func_get_args();
@@ -1714,6 +1737,7 @@ private function inheritConnectionOptions(array $options = []): array
17141737
}
17151738

17161739
/** @inheritdoc */
1740+
#[Override]
17171741
public function __call($method, $parameters)
17181742
{
17191743
if ($method === 'unset') {
@@ -1724,90 +1748,105 @@ public function __call($method, $parameters)
17241748
}
17251749

17261750
/** @internal This method is not supported by MongoDB. */
1751+
#[Override]
17271752
public function toSql()
17281753
{
17291754
throw new BadMethodCallException('This method is not supported by MongoDB. Try "toMql()" instead.');
17301755
}
17311756

17321757
/** @internal This method is not supported by MongoDB. */
1758+
#[Override]
17331759
public function toRawSql()
17341760
{
17351761
throw new BadMethodCallException('This method is not supported by MongoDB. Try "toMql()" instead.');
17361762
}
17371763

17381764
/** @internal This method is not supported by MongoDB. */
1765+
#[Override]
17391766
public function whereColumn($first, $operator = null, $second = null, $boolean = 'and')
17401767
{
17411768
throw new BadMethodCallException('This method is not supported by MongoDB');
17421769
}
17431770

17441771
/** @internal This method is not supported by MongoDB. */
1772+
#[Override]
17451773
public function whereFullText($columns, $value, array $options = [], $boolean = 'and')
17461774
{
17471775
throw new BadMethodCallException('This method is not supported by MongoDB');
17481776
}
17491777

17501778
/** @internal This method is not supported by MongoDB. */
1779+
#[Override]
17511780
public function groupByRaw($sql, array $bindings = [])
17521781
{
17531782
throw new BadMethodCallException('This method is not supported by MongoDB');
17541783
}
17551784

17561785
/** @internal This method is not supported by MongoDB. */
1786+
#[Override]
17571787
public function orderByRaw($sql, $bindings = [])
17581788
{
17591789
throw new BadMethodCallException('This method is not supported by MongoDB');
17601790
}
17611791

17621792
/** @internal This method is not supported by MongoDB. */
1793+
#[Override]
17631794
public function unionAll($query)
17641795
{
17651796
throw new BadMethodCallException('This method is not supported by MongoDB');
17661797
}
17671798

17681799
/** @internal This method is not supported by MongoDB. */
1800+
#[Override]
17691801
public function union($query, $all = false)
17701802
{
17711803
throw new BadMethodCallException('This method is not supported by MongoDB');
17721804
}
17731805

17741806
/** @internal This method is not supported by MongoDB. */
1807+
#[Override]
17751808
public function having($column, $operator = null, $value = null, $boolean = 'and')
17761809
{
17771810
throw new BadMethodCallException('This method is not supported by MongoDB');
17781811
}
17791812

17801813
/** @internal This method is not supported by MongoDB. */
1814+
#[Override]
17811815
public function havingRaw($sql, array $bindings = [], $boolean = 'and')
17821816
{
17831817
throw new BadMethodCallException('This method is not supported by MongoDB');
17841818
}
17851819

17861820
/** @internal This method is not supported by MongoDB. */
1821+
#[Override]
17871822
public function havingBetween($column, iterable $values, $boolean = 'and', $not = false)
17881823
{
17891824
throw new BadMethodCallException('This method is not supported by MongoDB');
17901825
}
17911826

17921827
/** @internal This method is not supported by MongoDB. */
1828+
#[Override]
17931829
public function whereIntegerInRaw($column, $values, $boolean = 'and', $not = false)
17941830
{
17951831
throw new BadMethodCallException('This method is not supported by MongoDB');
17961832
}
17971833

17981834
/** @internal This method is not supported by MongoDB. */
1835+
#[Override]
17991836
public function orWhereIntegerInRaw($column, $values)
18001837
{
18011838
throw new BadMethodCallException('This method is not supported by MongoDB');
18021839
}
18031840

18041841
/** @internal This method is not supported by MongoDB. */
1842+
#[Override]
18051843
public function whereIntegerNotInRaw($column, $values, $boolean = 'and')
18061844
{
18071845
throw new BadMethodCallException('This method is not supported by MongoDB');
18081846
}
18091847

18101848
/** @internal This method is not supported by MongoDB. */
1849+
#[Override]
18111850
public function orWhereIntegerNotInRaw($column, $values, $boolean = 'and')
18121851
{
18131852
throw new BadMethodCallException('This method is not supported by MongoDB');

0 commit comments

Comments
 (0)