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

fix(team): Add nullable team_id #2607

Merged
merged 1 commit into from Mar 6, 2024
Merged

Conversation

Androlax2
Copy link
Contributor

Added null to helpers getPermissionsTeamId and setPermissionsTeamId and in the PermissionRegistrar.

This is to fix a PHPStan problem :

Parameter #1 $id of function setPermissionsTeamId expects Illuminate\Database\Eloquent\Model|int|string, null given.

But when you put '', my tests are failing because it expects a null as per the doc.

@drbyte
Copy link
Collaborator

drbyte commented Mar 6, 2024

@erikn69 any downsides to this?

@erikn69
Copy link
Contributor

erikn69 commented Mar 6, 2024

It doesn't affect anything
Seems like a fix to me

* @param int|string|\Illuminate\Database\Eloquent\Model|null $id
*/
public function setPermissionsTeamId($id): void

@drbyte
Copy link
Collaborator

drbyte commented Mar 6, 2024

Thanks!

@drbyte drbyte merged commit e4fd5ca into spatie:main Mar 6, 2024
22 checks passed
@func0der
Copy link

func0der commented Apr 19, 2024

Could have added the type to the property, too, since it is initialized with null.
Would make the whole thing more coherent.

Thanks for the fix. Was about to open a bug report for is myself just now xD

drbyte added a commit that referenced this pull request Apr 19, 2024
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

Successfully merging this pull request may close these issues.

None yet

4 participants