Skip to content

Commit f90bf78

Browse files
GromNaNalcaeus
authored andcommitted
Add header documentation for classes & traits that can be used in applications (#12)
* Add header documentation for classes & traits that can be used in applications * Precise mixed types when possible
1 parent cfbff5c commit f90bf78

File tree

6 files changed

+21
-8
lines changed

6 files changed

+21
-8
lines changed

src/Collection.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
use MongoDB\BSON\ObjectID;
77
use MongoDB\Collection as MongoCollection;
88

9+
/**
10+
* @mixin MongoCollection
11+
*/
912
class Collection
1013
{
1114
/**

src/Connection.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use MongoDB\Database;
1313
use Throwable;
1414

15+
/**
16+
* @mixin Database
17+
*/
1518
class Connection extends BaseConnection
1619
{
1720
use ManagesTransactions;

src/Eloquent/Casts/BinaryUuid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function get($model, string $key, $value, array $attributes)
4646
* @param string $key
4747
* @param mixed $value
4848
* @param array $attributes
49-
* @return mixed
49+
* @return Binary
5050
*/
5151
public function set($model, string $key, $value, array $attributes)
5252
{

src/Eloquent/EmbedsRelations.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
use Jenssegers\Mongodb\Relations\EmbedsMany;
77
use Jenssegers\Mongodb\Relations\EmbedsOne;
88

9+
/**
10+
* Embeds relations for MongoDB models.
11+
*/
912
trait EmbedsRelations
1013
{
1114
/**

src/Eloquent/HybridRelations.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
use Jenssegers\Mongodb\Relations\MorphMany;
1313
use Jenssegers\Mongodb\Relations\MorphTo;
1414

15+
/**
16+
* Cross-database relationships between SQL and MongoDB.
17+
* Use this trait in SQL models to define relationships with MongoDB models.
18+
*/
1519
trait HybridRelations
1620
{
1721
/**

src/Query/Builder.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -788,9 +788,9 @@ public function raw($expression = null)
788788
/**
789789
* Append one or more values to an array.
790790
*
791-
* @param mixed $column
792-
* @param mixed $value
793-
* @param bool $unique
791+
* @param string|array $column
792+
* @param mixed $value
793+
* @param bool $unique
794794
* @return int
795795
*/
796796
public function push($column, $value = null, $unique = false)
@@ -818,14 +818,14 @@ public function push($column, $value = null, $unique = false)
818818
/**
819819
* Remove one or more values from an array.
820820
*
821-
* @param mixed $column
822-
* @param mixed $value
821+
* @param string|array $column
822+
* @param mixed $value
823823
* @return int
824824
*/
825825
public function pull($column, $value = null)
826826
{
827827
// Check if we passed an associative array.
828-
$batch = (is_array($value) && array_keys($value) === range(0, count($value) - 1));
828+
$batch = is_array($value) && array_is_list($value);
829829

830830
// If we are pulling multiple values, we need to use $pullAll.
831831
$operator = $batch ? '$pullAll' : '$pull';
@@ -842,7 +842,7 @@ public function pull($column, $value = null)
842842
/**
843843
* Remove one or more fields.
844844
*
845-
* @param mixed $columns
845+
* @param string|string[] $columns
846846
* @return int
847847
*/
848848
public function drop($columns)

0 commit comments

Comments
 (0)