-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Clean phpdoc and arg names for relation traits #2587
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
Conversation
060293e
to
47c4383
Compare
* @param string $foreignKey | ||
* @param string $relation | ||
* @return \MongoDB\Laravel\Relations\EmbedsMany | ||
* @param class-string $related |
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.
use Illuminate\Database\Eloquent\Relations\MorphOne; | ||
use Illuminate\Support\Str; | ||
use MongoDB\Laravel\Eloquent\Model as MongoDBModel; |
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.
Was this necessary? We're not referencing another Model class in this file and I don't recall seeing an alias used elsewhere (in previous PRs).
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.
My idea was that it's more explicit that we need a MongoDB Model and not the Eloquent Base Model.
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.
Got it. No argument if this was done for readability 👍
* @param string $relation | ||
* @param class-string $related | ||
* @param string|null $foreignKey | ||
* @param string|null $ownerKey |
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.
Is the variable change here done for consistency with a base Laravel class/trait?
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.
Yes and for correctness.
* @param class-string $related | ||
* @param string|null $collection | ||
* @param string|null $foreignPivotKey | ||
* @param string|null $relatedPivotKey |
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.
$relatedPivotKey
sounds much more descriptive than $otherKey
. 👍
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.
That was the first motivation. I didn't understand the meaning of all this parameters.
Apply arg name change from laravel/framework#18380 and param types from laravel/framework#31252