- Issue created by @Chi
- 🇷🇺Russia Chi
I wonder if we really need to update the version manually. Can we fetch the version from Composer instead?
Composer\InstalledVersions::getVersion('drupal/core')
- 🇬🇧United Kingdom alexpott 🇪🇺🌍
Let's refocus this issue on the idea in #3 since we've got the original intention of this issue covered in 🐛 \Drupal::VERSION on 11.x not correct Active
Note this is likely to be quite tricky because Composer is returning
11.1.9999999.9999999-dev
for 11.1.x and11.9999999.9999999.9999999-dev
for 11.x - these version strings are correct BUT I'm pretty sure we have regex parsing of \Drupal::VERSION that assumes only major, minor, patch and I'm not sure that the regex patterns will cope with the fourth number. I think this is the internal representation - see https://getcomposer.org/doc/articles/versions.md#stability-constraints - 🇷🇺Russia Chi
We may use
getPrettyVersion()
instead.echo Composer\InstalledVersions::getVersion('drupal/core'), \PHP_EOL; echo Composer\InstalledVersions::getPrettyVersion('drupal/core'), \PHP_EOL;
Output on 10.3.10
10.3.10.0 10.3.10
Output on 11.x
11.9999999.9999999.9999999-dev 11.x-dev
- 🇷🇺Russia Chi
Given that expressions are not allowed in class constants we will have to deprecate that constant in favor of static method.
public static function version():string { return InstalledVersions::getPrettyVersion('drupal/core'); }
- First commit to issue fork.
- Merge request !10325Draft: Deprecate \Drupal::VERSION and use \Composer\InstalledVersions::getVersion → (Open) created by arunkumark
- 🇮🇳India arunkumark Coimbatore
Created drafted MR as per the suggestion given by @chi in comments #7 and #8. The function
getPrettyVersion()
gives the proper version details. - 🇬🇧United Kingdom oily Greater London
@chi @arunkumark Is a change record required? Change record doc →
- 🇫🇷France andypost
Surely it needs change record as method supposed to be introduced instead of constant
- 🇳🇿New Zealand quietone
Restoring standard template because it helps keep track of the work and it helps reviewers and committers.
- 🇬🇧United Kingdom oily Greater London
Work done on the 2x code comments.
Deprecated the constant and added @deprecated to docblock.
Pipeline error. Not sure how to fix.
- 🇬🇧United Kingdom oily Greater London
Tried to fix PHPSTAN in pipeline. There is no clear error message. Not sure if it is a defect in the pipeline or error(s) in the code.
- 🇮🇳India arunkumark Coimbatore
Am also tried to resolve the PHPStan error, but could not solve it. Not sure if the stan error is because of a patch or something else.
- 🇬🇧United Kingdom oily Greater London
I am seeing this: "Merge blocked: 1 check failed". It states that the MR must not be draft (in order for the merge to be allowed).
- 🇬🇧United Kingdom oily Greater London
There are now several PHPSTAN errors mentioning deprecated constants. I tried to PHPSTAN ignore one of the errors but not working.
Trying to figure out how to eliminate the remaining deprecation-related errors.
- 🇬🇧United Kingdom oily Greater London
Added change record.
Currently stumped on eliminating deprecation related PHPSTAN errors.
Changing to 'Needs review' hoping guidance on errors.
- 🇬🇧United Kingdom joachim
What's the performance cost?
\Composer\InstalledVersions::getVersion() includes a file with 2000 lines of code in a monster array.
- 🇷🇺Russia Chi
It takes 0.015 ms on my localhost. That file is likely loaded from opcache and Composer caches the array in static variable. So it's Ok to call this method multiple times.