Skip to content

implement DeptracVersion class#1477

Merged
gennadigennadigennadi merged 4 commits into
4.0.xfrom
add-deptracversion
Jul 17, 2025
Merged

implement DeptracVersion class#1477
gennadigennadigennadi merged 4 commits into
4.0.xfrom
add-deptracversion

Conversation

@gennadigennadigennadi

Copy link
Copy Markdown
Collaborator

fixes: #1476:

This comment was marked as outdated.

@gennadigennadigennadi gennadigennadigennadi force-pushed the add-deptracversion branch 2 times, most recently from 9ba1ac8 to 35f6dee Compare July 15, 2025 20:02
@gennadigennadigennadi gennadigennadigennadi self-assigned this Jul 15, 2025
adds dynamic version resolution via composer installed version
@gennadigennadigennadi gennadigennadigennadi marked this pull request as ready for review July 15, 2025 20:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';

Comment thread config/cache.php
drop symfony reference
@gennadigennadigennadi gennadigennadigennadi merged commit 14066da into 4.0.x Jul 17, 2025
18 checks passed
@gennadigennadigennadi gennadigennadigennadi deleted the add-deptracversion branch July 17, 2025 21:36

@patrickkusebauch patrickkusebauch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a separate class for this was necessary, but otherwise LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to get the Deptrac version outside of phar

3 participants