cartalyst / sentinel

A framework agnostic authentication & authorization system.
BSD 3-Clause "New" or "Revised" License
1.51k stars 238 forks source link

[proposal] Consistant return types #500

Closed 8633brown closed 5 years ago

8633brown commented 5 years ago

The return types of some of the methods in Sentinel return bool or an object. As far as I can tell it's the only file in the code base that mixes return types like this. I think it would make sense to change the return types to null or an object. As from what I can tell most methods which return a bool or objects type dont truly return mixed types and instead only return false or an object. Rather than returning false I think returning null would be more sensible.

For example Sentinel::check only returns false or EloquentUser I think returning null makes more sense if a user is not logged in.

This way typehinting can be implemented on these methods and they would be more consistent with the rest of the project.

I understand this is a breaking change for user land I figured with the major revision happening this would be the best time to fix.

brunogaspar commented 5 years ago

I don't think we can do that on this version, but as far as i remember this is simpler on version 4.