-
Notifications
You must be signed in to change notification settings - Fork 171
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
refactor: static access for EnvironmentVariablesTrait methods #850
refactor: static access for EnvironmentVariablesTrait methods #850
Conversation
Thanks for opening your first pull request! If you haven't yet signed our Contributor License Agreement (CLA), then please do so that we can accept your contribution. A link should appear shortly in this PR if you have not already signed one. |
IMO we should drop the trait and use |
I agree, generally the trait doesn't add anything other than passing arguments on to the
When it comes to entirely static traits though, the benefits of this type of mixin behavior are somewhat lost. A single So options:
The largest impact in my opinion on this is whether anything using the trait does so not for internal private access, but public APIs. Namely, |
I'm in favour of option 3 - it doesn't need to be a trait, and I appreciate the typing and self-documenting that a class such as |
…d access utilizes Accessor and Variables under the hood to provide consistent default values
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #850 +/- ##
============================================
- Coverage 81.75% 81.69% -0.06%
+ Complexity 1947 1946 -1
============================================
Files 243 241 -2
Lines 5069 5080 +11
============================================
+ Hits 4144 4150 +6
- Misses 925 930 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
The
EnvironmentVariablesTrait
provided instance accessor methods with only static calls. This refactors those methods to be static, removing several cases of anonymous class instantiation to provide its functionality.It's still possible to access static methods through
$this->
so this is also non-breaking to consumers.