implement DeptracVersion class#1477
Merged
Merged
Conversation
cb175aa to
a700bb6
Compare
9ba1ac8 to
35f6dee
Compare
adds dynamic version resolution via composer installed version
35f6dee to
2797daa
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR implements a new DeptracVersion class to centralize version handling across the Deptrac application, replacing the previous approach of using a VERSION constant in the Application class. The implementation follows patterns from the Pie project and provides fallback mechanisms for version retrieval.
- Extracts version logic from Application class into a dedicated DeptracVersion utility class
- Implements fallback version detection using Composer's InstalledVersions when git version is unavailable
- Updates all references to use the new centralized version handling
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Supportive/Console/DeptracVersion.php | New utility class that handles version detection with git and Composer fallbacks |
| src/Supportive/Console/Application.php | Removes VERSION constant and uses DeptracVersion::get() instead |
| phpstan-baseline.neon | Adds suppression for PHPStan false positive about string comparison |
| config/cache.php | Updates cache configuration to use DeptracVersion::get() instead of Application::VERSION |
Comments suppressed due to low confidence (1)
src/Supportive/Console/DeptracVersion.php:18
- The constant name 'SYMFONY_MAGIC_CONST_UNKNOWN' is misleading since this is not a Symfony-specific constant and appears to be a general fallback value for unknown versions. Consider renaming to 'UNKNOWN_VERSION' or 'VERSION_UNKNOWN' for clarity.
private const SYMFONY_MAGIC_CONST_UNKNOWN = 'UNKNOWN';
drop symfony reference
895ddb0 to
a639235
Compare
patrickkusebauch
left a comment
Collaborator
There was a problem hiding this comment.
I don't think a separate class for this was necessary, but otherwise LGTM.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fixes: #1476: