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

[BUGFIX] Use self:: instead of static:: late binding for private constants #176

Conversation

NamelessCoder
Copy link
Contributor

Class constants are marked private but consuming code uses late static binding with static:: to access them. Since the constants are private, late static binding makes no sense (no subclass would be able to use the constants) and simply causes an error (access to undefined constant). This patch prevents that error from happening in e.g. https://github.com/georgringer/oidc-be.

There are two ways to solve this:

  • Declare the constants protected or public.
  • Or do not use late static binding.

I've chosen the latter in this case since there will not be a need to change the values of these constants or access them externally. Any subclass that chooses to override the method that does use the constants will have to return these values in another way or call the parent:: method to perform the initial validation and get a return code based on the constants.

@liayn
Copy link
Collaborator

liayn commented Oct 4, 2024

Thanks Claus.

@liayn liayn merged commit 6593630 into xperseguers:master Oct 4, 2024
@NamelessCoder NamelessCoder deleted the feature/fix-late-static-bound-constant branch October 4, 2024 09:05
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.

2 participants