dev/core#3833 Update CRM_Extension_Downloader to not use dynamic properties #24438
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.
Overview
Update CRM_Extension_Downloader to not use dynamic properties.
First of many required changes for dev/core#3833
Before
The
CRM_Extension_Downloader
class used dynamic properties which are going to be deprecated in PHP 8.2, and which harm readability.After
$manager
andcontainerDir
are no longer dynamic properties.I've re-arranged some of the properties and methods so that the
constructor
comes first, and so that the property order better matches the order in which they are defined.Whilst in this file I've also removed the line
$destDir = $this->containerDir . DIRECTORY_SEPARATOR . $key;
as$destDir
was not being used.Technical Details
I've decided to make
manager
andcontainerDir
private, as I could not see a need for them to be public. That said it required some thinking about, and happy to hear arguments to the contrary. This highlights both why resolving #3833 will be a good excercise, but also why it may be difficult and time-consuming.I also think
guzzleClient
could be private rather than protected, but didn't change it incase there is a reason I am not seeing.