Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move the obtaining the version method to a separate class #131

Merged
merged 2 commits into from
Nov 26, 2024

Conversation

godruoyi
Copy link
Contributor

No description provided.

src/Util/PipVersion.php Outdated Show resolved Hide resolved
@asgrim asgrim self-assigned this Nov 25, 2024
@asgrim asgrim added the enhancement New feature or request label Nov 25, 2024
@asgrim asgrim force-pushed the godruoyi/move-getversion-method-to-class branch from 03be73a to 9c69fab Compare November 26, 2024 07:57
@asgrim asgrim added this to the 0.3.0 milestone Nov 26, 2024
@asgrim asgrim merged commit 75dbc22 into php:main Nov 26, 2024
19 checks passed
@asgrim
Copy link
Collaborator

asgrim commented Nov 26, 2024

Thanks @godruoyi !

@godruoyi godruoyi deleted the godruoyi/move-getversion-method-to-class branch November 26, 2024 09:15
{
/**
* Note: magic constant that causes Symfony Console to not display a version
* {@see Application::getLongVersion()}
Copy link
Member

Choose a reason for hiding this comment

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

This is a dead reference, because Application is not imported here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hah, good spot - indeed it's not fully qualified, but PhpStorm doesn't seem to mind, I'd actually checked I could click through, so missed it wasn't fully qualified

Screenshot from 2024-11-26 09-24-37

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank guys for your suggestions. I'll update them in next PR. And I have a question why we need to define a variable here? for me understand is this always true right? should we delete it directly?

    public static function get(): string
    {
        $pieVersion = '@pie_version@';

        if ($pieVersion === '@pie_version' . '@') {
            // always be true
        }
    }

Copy link
Collaborator

Choose a reason for hiding this comment

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

@godruoyi I actually added a comment to the class in your PR:

/**
* This value is replaced dynamically by Box with the real version when
* we build the PHAR. It is based on the Git tag and/or version
*
* It will be replaced with `2.0.0` on an exact tag match, or something
* like `2.0.0@e558e33` on a commit following a tag.
*
* When running not in a PHAR, this will not be replaced, so this
* method needs additional logic to determine the version.
*
* @link https://box-project.github.io/box/configuration/#pretty-git-tag-placeholder-git
*/
$pieVersion = '@pie_version@';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants