phpstan: version is not displayed

Command options tell that -V flag should “Display this application version”. Anyway, executing phpstan -V only outputs “PHPStan - PHP Static Analysis Tool”

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@ondrejmirtes We could use Ocramius/PackageVersions to eliminate development overhead.

I plan to add current version number to PHAR builds of PHPStan which will be published from 0.7 onward. Adding the version to Composer distribution which is just a git clone of source code represents overhead…

Commonly done in PHP tools since most CLI tools do. And not everybody will have to install via composer presumably?

I wonder why incorporate another dependency just to support spitting out the version with -v when a simple const VERSION does the trick?

I just checked several PHP-based CLI tools (phpspec, phpunit, behat, and doctrine-module), and they all supported --version or similar.

Several did it with just a const VERSION = ‘3.3.0’, sometimes in a dedicated file (e.g. DoctrineModule/Version.php or phpunit Runner/Version.php ). One tool (phpspec) passed ‘3.2.2’ through to an anonymous function as $version, then on through to Symfony\Console. All from the top level file, to make it easy to change I presume.

Bumping the version then just has to be part of the release process.

Correct version will be output thanks to #433 even in a project-installed dependency by Composer 😃

I just released PHPStan 0.7 including a PHAR archive. The version cloned from Git will show Version unknown, while the PHAR version will show 0.7. I consider this issue solved.

It’s useful for version check (e.g. if you have more versions installed) or in case you don’t have composer available;)

Well, I agree that showing a version is not a must. All I ask is avoiding to fool your users, telling that you’ll show a version and failing to do so.

Do you need to output the version? The version of the tool is displayed when you install it with Composer, adding it to the tool itself would present overhead with each release.