Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Add header documentation for classes & traits that can be used in applications #12

Merged
merged 2 commits into from
Jul 13, 2023

Conversation

GromNaN
Copy link
Owner

@GromNaN GromNaN commented Jul 12, 2023

The @mixin DocBlock allows you to signal that all properties and methods of another class are available on the class where the mixin is applied upon. (source)

This is the case for Collection and Connection which are decorators for MongoDB objects.

@GromNaN GromNaN requested review from jmikola and alcaeus July 12, 2023 20:53
@@ -46,7 +46,7 @@ public function get($model, string $key, $value, array $attributes)
* @param string $key
* @param mixed $value
* @param array $attributes
* @return mixed
* @return Binary
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By reading the code, Binary is the only possible return type.

/**
* Cross-database relationships between SQL and MongoDB.
* Use this trait in SQL models to define relationships with MongoDB models.
*/
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc in Readme.

* @param mixed $column
* @param mixed $value
* @param bool $unique
* @param string|array $column
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not an array, $column is used as array key.

@@ -818,14 +818,14 @@ public function push($column, $value = null, $unique = false)
/**
* Remove one or more values from an array.
*
* @param mixed $column
* @param mixed $value
* @param string|array $column
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not an array, $column is used as array key.

@@ -56,7 +56,7 @@ abstract class Model extends BaseModel
* Custom accessor for the model's id.
*
* @param mixed $value
* @return mixed
* @return string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is incorrect: any value other than ObjectId or Binary instances will be left as-is, so the return type is indeed mixed. Consider having a numeric identifier, which will be returned as int.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted this change.

Copy link
Collaborator

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GromNaN GromNaN merged commit bd86f85 into master Jul 13, 2023
@GromNaN GromNaN deleted the traits-doc branch July 13, 2023 09:33
GromNaN added a commit that referenced this pull request Aug 22, 2023
…lications (#12)

* Add header documentation for classes & traits that can be used in applications
* Precise mixed types when possible
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants