You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR refactors all self:: static property accesses to static:: in GiteaTest.php, enabling Late Static Binding (LSB) as a foundation for supporting future test adapters. The change is low-risk and functionally equivalent for the current single test class, but requires one follow-up to be fully effective.
All self::$accessToken and self::$owner references in GiteaTest are consistently updated to static::$accessToken / static::$owner across setUp(), setupGitea(), and every test method.
The two static properties ($accessToken and $owner) are still declared as private static, which means LSB has no practical effect — static:: on a private property always resolves to the declaring class, regardless of the runtime class. For the stated goal of supporting subclass adapters, these properties should also be changed from private to protected.
Confidence Score: 4/5
Safe to merge — the change is functionally a no-op for the existing test class; however, the intended benefit (supporting subclass adapters) will only materialise once the property visibility is updated to protected.
The refactor is mechanical and consistent. It does not break any existing tests because static:: on private properties resolves identically to self:: within the same class. One minor follow-up is needed — changing the visibility from private to protected — to make the LSB refactor actually useful for future subclasses.
tests/VCS/Adapter/GiteaTest.php — property visibility should be protected static to complement the LSB refactor.
Important Files Changed
Filename
Overview
tests/VCS/Adapter/GiteaTest.php
Refactors all self:: accesses of static properties to static:: (Late Static Binding), but the two static properties remain private, which means LSB provides no real benefit yet; changing their visibility to protected is needed to fulfil the PR's intent of supporting future adapters/subclasses.
Comments Outside Diff (1)
tests/VCS/Adapter/GiteaTest.php, line 14-15 (link)
static:: has no effect on private properties
The PR's stated goal is to support future subclasses ("Will be useful once we add more adapters"), which is exactly why static:: (Late Static Binding) is being introduced. However, both $accessToken and $owner are declared as private static, which means:
They are not inherited by subclasses — a subclass cannot see or share these properties.
static::$accessToken inside a method of GiteaTest will always resolve to GiteaTest::$accessToken, making the LSB change a no-op for the current class.
If a future subclass is introduced, static::$accessToken in the inherited setUp() would attempt to resolve against the child class, where the property doesn't exist — potentially causing unexpected behavior or errors.
To fulfil the stated intent, these properties should be changed to protected static:
This allows subclasses to inherit and override the values independently, which is exactly the use-case LSB is designed for.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Will be useful once we add more adapters