-
Notifications
You must be signed in to change notification settings - Fork 208
Improve docblocks #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
87c283f
d3e04fb
7e8d2c2
ae182d1
d587a84
19fb9bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
use MongoDB\Cursor; | ||
use MongoDB\CursorId; | ||
use Mongodb\Server; | ||
|
||
/** | ||
* Cursor implementation that may be constructed from values found in a | ||
|
@@ -34,37 +35,42 @@ public function __construct(Server $server, CursorId $cursorId, array $firstBatc | |
$this->firstBatch = $firstBatch; | ||
} | ||
|
||
// Iterator methods... | ||
|
||
/** | ||
* @return Cursor::getId() | ||
* @return CursorId | ||
*/ | ||
public function getId() | ||
{ | ||
return $this->cursorId; | ||
} | ||
|
||
/** | ||
* @see Cursor::getServer() | ||
* @return Server Server from which the cursor originated | ||
*/ | ||
public function getServer() | ||
{ | ||
return $this->server; | ||
} | ||
|
||
/** | ||
* @see Cursor::isDead() | ||
* @return boolean Whether the cursor is exhausted and has no more results | ||
*/ | ||
public function isDead() | ||
{ | ||
// Return whether the cursor is exhausted and has no more results | ||
} | ||
|
||
/** | ||
* @see \MongoDB\Cursor::setBatchSize() | ||
* @param integer $batchSize | ||
*/ | ||
public function setBatchSize($batchSize) | ||
{ | ||
$this->batchSize = (integer) $batchSize; | ||
} | ||
|
||
/* Cursor is an iterator */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
public function current() {} | ||
public function next() {} | ||
public function key() {} | ||
public function valid() {} | ||
public function rewind() {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ final class CursorId | |
// $id is an internal uint64_t value instead of a class property | ||
|
||
/** | ||
* @param integer|string $id | ||
* @param string $id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see why this shouldn't be able to take an integer, provided the architecture supports it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we'll then end up with the "if 32bit? code-rot else tested code that we know how works" Why should it be an integer anyway? Will it always be an int in the future? can't it just as well be mongoid? Or something that can be traced back to the particular server/shard? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If an integer is passed, ZPP would implicitly cast it to a string, wouldn't it? Even if we document it as I just realized we don't have any API example of where the CursorId comes from. As-is, I expect they need to check the command result document and construct it accordingly. Will that value have been converted to a MongoInt64 already on a 32-bit platform and left as an integer on 64-bit? If so, MongoInt64 would already work because it has a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why can't it be a string in both cases? |
||
*/ | ||
public function __construct($id) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,8 @@ final class Query | |
* @param array|object $query Query document | ||
* @param array|object $selector Selector document | ||
* @param integer $flags Query flags | ||
* @param integer $limit Limit | ||
* @param integer $skip Skip | ||
* @param integer $limit Limit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. limit 10 skip 15 reads like a overflow and weird api. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted. Fine as-is. |
||
*/ | ||
public function __construct($query, $selector, $flags, $skip, $limit) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
use MongoDB\Cursor; | ||
use MongoDB\CursorId; | ||
use Mongodb\Server; | ||
|
||
/** | ||
* Cursor implementation that is returned after executing a Query. | ||
|
@@ -21,6 +22,8 @@ final class QueryCursor implements Cursor | |
private $cursorId; | ||
|
||
/** | ||
* Construct a new QueryCursor | ||
* | ||
* @param Server $server | ||
* @param CursorId $cursorId | ||
*/ | ||
|
@@ -30,37 +33,42 @@ public function __construct(Server $server, CursorId $cursorId) | |
$this->cursorId = $cursorId; | ||
} | ||
|
||
// Iterator methods... | ||
|
||
/** | ||
* @see Cursor::getId() | ||
* @return CursorId | ||
*/ | ||
public function getId() | ||
{ | ||
return $this->cursorId; | ||
} | ||
|
||
/** | ||
* @see Cursor::getServer() | ||
* @return Server Server from which the cursor originated | ||
*/ | ||
public function getServer() | ||
{ | ||
return $this->server; | ||
} | ||
|
||
/** | ||
* @see Cursor::isDead() | ||
* @return boolean Whether the cursor is exhausted and has no more results | ||
*/ | ||
public function isDead() | ||
{ | ||
// Return whether the cursor is exhausted and has no more results | ||
} | ||
|
||
/** | ||
* @see Cursor::setBatchSize() | ||
* @param integer $batchSize | ||
*/ | ||
public function setBatchSize($batchSize) | ||
{ | ||
$this->batchSize = (integer) $batchSize; | ||
} | ||
|
||
/* Cursor is an iterator */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
public function current() {} | ||
public function next() {} | ||
public function key() {} | ||
public function valid() {} | ||
public function rewind() {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
include "api/MongoDB/Cursor.php"; | ||
include "api/MongoDB/CursorId.php"; | ||
include "api/MongoDB/Manager.php"; | ||
include "api/MongoDB/ReadPreference.php"; | ||
include "api/MongoDB/Server.php"; | ||
include "api/MongoDB/Query/Query.php"; | ||
include "api/MongoDB/Query/QueryCursor.php"; | ||
include "api/MongoDB/Command/Command.php"; | ||
include "api/MongoDB/Command/CommandCursor.php"; | ||
include "api/MongoDB/Command/CommandResult.php"; | ||
include "api/MongoDB/Write/WriteBatch.php"; | ||
include "api/MongoDB/Write/WriteResult.php"; | ||
include "api/MongoDB/Write/DeleteBatch.php"; | ||
include "api/MongoDB/Write/DeleteResult.php"; | ||
include "api/MongoDB/Write/GeneratedId.php"; | ||
include "api/MongoDB/Write/InsertBatch.php"; | ||
include "api/MongoDB/Write/InsertResult.php"; | ||
include "api/MongoDB/Write/UpdateBatch.php"; | ||
include "api/MongoDB/Write/UpdateResult.php"; | ||
include "api/MongoDB/Write/WriteConcernError.php"; | ||
include "api/MongoDB/Write/WriteError.php"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When implementing an interface or overriding a method, I do this instead of copy/pasting. It's up to you.
Some projects use
@inheritDoc
, but I've had mixed results with it and this is more explicit, as any generator should create a hyperlink to the referenced doc block.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmmh.
I'm using this data to create the extension skeleton. Not really keen on making a full fledged javadoc parser :)