Skip to content
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

PHPDoc wrong return type for Friendable::findFriendships #96

Open
FlYos opened this issue May 13, 2023 · 1 comment
Open

PHPDoc wrong return type for Friendable::findFriendships #96

FlYos opened this issue May 13, 2023 · 1 comment

Comments

@FlYos
Copy link
Contributor

FlYos commented May 13, 2023

Hi,

If I am not mistaken, I believe the PHPDoc is wrong for the return type.
It should be Illuminate\Database\Eloquent\Builder instead of Illuminate\Database\Eloquent\Collection, It's right ?

/**
* @param $status
* @param string $groupSlug
* @param string $type
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function findFriendships($status = null, string $groupSlug = '', string $type = 'all')
{
$friendshipModelName = Interaction::getFriendshipModelName();
$query = $friendshipModelName::where(function ($query) use ($type) {
switch ($type) {
case 'all':
$query->where(function ($q) {
$q->whereSender($this);
})
->orWhere(function ($q) {
$q->whereRecipient($this);
});
break;
case 'sender':
$query->where(function ($q) {
$q->whereSender($this);
});
break;
case 'recipient':
$query->where(function ($q) {
$q->whereRecipient($this);
});
break;
}
})->whereGroup($this, $groupSlug);
//if $status is passed, add where clause
if ( ! is_null($status)) {
$query->where('status', $status);
}
return $query;
}

@mkwsra
Copy link
Member

mkwsra commented May 13, 2023

Yes indeed, please give it a run on your locale machine after you change the libraries file from within /vendor and if everything is okay, can you please create a PR? I would be glad to accept it.

Thanks for noticing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants