Skip to content

Commit

Permalink
refactor: changed annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoFerrazfs committed Oct 1, 2024
1 parent 528742e commit 82bc9c9
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 27 deletions.
16 changes: 1 addition & 15 deletions src/Cursor/Cursor.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ class Cursor implements CursorInterface
{
/**
* The MongoDB cursor used to interact with db.
*
*/
protected ?Iterator $cursor = null;

/**
* Iterator position (to be used with foreach).
*
*/
protected int $position = 0;

Expand All @@ -49,8 +47,6 @@ public function __construct(
* Limits the number of results returned.
*
* @param int $amount the number of results to return
*
* @return static
*/
public function limit(int $amount): static
{
Expand All @@ -65,8 +61,6 @@ public function limit(int $amount): static
* @param array $fields An array of fields by which to sort.
* Each element in the array has as key the field name,
* and as value either 1 for ascending sort, or -1 for descending sort.
*
* @return static
*/
public function sort(array $fields): static
{
Expand All @@ -79,8 +73,6 @@ public function sort(array $fields): static
* Skips a number of results.
*
* @param int $amount the number of results to skip
*
* @return static
*/
public function skip(int $amount): static
{
Expand Down Expand Up @@ -110,8 +102,6 @@ public function disableTimeout(bool $flag = true): static
* @param int $mode preference mode that the Cursor will use
*
* @see ReadPreference::class To get a glance of the constants available
*
* @return $this
*/
public function setReadPreference(int $mode): static
{
Expand All @@ -121,9 +111,7 @@ public function setReadPreference(int $mode): static
}

/**
* Counts the number of results for this cursor.
*
* @return int the number of documents returned by this cursor's query
* Counts the number of documents returned by this cursor's query.
*/
public function count(): int
{
Expand Down Expand Up @@ -255,8 +243,6 @@ public function __serialize(): array

/**
* Unserializes this object. Re-creating the database connection.
*
* @param array $serialized serialized cursor
*/
public function __unserialize(array $attributes): void
{
Expand Down
2 changes: 0 additions & 2 deletions src/Cursor/EmbeddedCursor.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public function limit(int $amount): static
* @param array $fields An array of fields by which to sort.
* Each element in the array has as key the field name,
* and as value either 1 for ascending sort, or -1 for descending sort.
*
* @return EmbeddedCursor returns this cursor
*/
public function sort(array $fields): static
{
Expand Down
4 changes: 0 additions & 4 deletions src/Cursor/SchemaCacheableCursor.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ class SchemaCacheableCursor extends SchemaCursor
/**
* Limit of the query. It is stored because when caching the documents
* the DOCUMENT_LIMIT const will be used.
*
*/
protected int $originalLimit = 0;

/**
* Means that the CacheableCursor is wapping the original cursor and not
* reading from Cache anymore.
*
*/
protected bool $ignoreCache = false;

Expand Down Expand Up @@ -105,8 +103,6 @@ protected function getCursor(): Iterator

/**
* Generates an unique cache key for the cursor in it's current state.
*
* @return string cache key to identify the query of the current cursor
*/
protected function generateCacheKey(): string
{
Expand Down
6 changes: 1 addition & 5 deletions src/Cursor/SchemaCursor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
use Mongolid\Connection\Connection;
use Mongolid\Container\Container;
use Mongolid\LegacyRecord;
use Traversable;
use MongoDB\Collection;
use MongoDB\Driver\Cursor as DriverCursor;
use MongoDB\Driver\Exception\LogicException;
use Mongolid\DataMapper\EntityAssembler;
use Mongolid\Schema\Schema;
Expand Down Expand Up @@ -122,9 +120,7 @@ public function setReadPreference(int $mode): static
}

/**
* Counts the number of results for this cursor.
*
* @return int the number of documents returned by this cursor's query
* Counts the number of results documents returned by this cursor's query.
*/
public function count(): int
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cursor/SchemaEmbeddedCursor.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function skip(int $amount): static
}

/**
* Counts the number of results for this cursor.
* Counts the number of documents returned by this cursor's query.
*/
public function count(): int
{
Expand Down

0 comments on commit 82bc9c9

Please sign in to comment.