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

Make User::verifyAuthTypeCookie static #2250

Merged
merged 2 commits into from Apr 16, 2015

Conversation

mlocati
Copy link
Contributor

@mlocati mlocati commented Apr 15, 2015

It's called statically and doesn't contain any reference to $this, so it's safe to mark it as static

It's called statically and doesn't contain any reference to $this, so it's safe to mark it as static
@KorvinSzanto
Copy link
Member

It'd be better to move this and other auth validators into its own new
construct.

On Tue, Apr 14, 2015, 11:05 PM Michele Locati notifications@github.com
wrote:

It's called statically and doesn't contain any reference to $this, so

it's safe to mark it as static

You can view, comment on, or merge this pull request online at:

#2250
Commit Summary

  • Make User::verifyAuthTypeCookie static
  • PSR

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#2250.

@mlocati
Copy link
Contributor Author

mlocati commented Apr 15, 2015

It'd be better to move this and other auth validators into its own new
construct.

I absolutely don't understand what you mean 😖

@KorvinSzanto
Copy link
Member

I feel like the fact that this doesn't rely on an instance of \User is more an indicator that this method shouldn't be on the User class than that this method should be static. Converting this method to static prevents things like mocking in tests and makes it harder to override, so maybe a \Concrete\Core\Authentication\Validator that you can get an instance of from \Core::make('authentication/validator').

That makes it easy to override, makes it mockable (since this is a very likely candidate for mocking), and categorizes the functionality to better align with SRP.

@mlocati
Copy link
Contributor Author

mlocati commented Apr 15, 2015

I thought that this kind of stuff was demanded to the core team 😉. What I'm doing with these pull requests is to lower the number of warnings thrown by PHP (see #1309): I modified the Whoops error handler to store all the warnings to a sqlite DB and then I'm fixing the most recurring ones.

@KorvinSzanto
Copy link
Member

Ah fair, just my half asleep morning 2c

@aembler aembler merged commit 67b5abc into concretecms:develop Apr 16, 2015
@mlocati mlocati deleted the fixwarnings-verifyAuthTypeCookie branch April 16, 2015 06:22
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

3 participants