Ocramius / PackageVersions

:package: Composer addon to efficiently get installed packages' version numbers
MIT License
3.22k stars 67 forks source link

'private static string' in installer.php #137

Closed necmettin closed 4 years ago

necmettin commented 4 years ago

Is this not an error? Am I missing something?

private static string $generatedClassTemplate = <<<'PHP'

And the error message: Parse error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in vendor/ocramius/package-versions/src/PackageVersions/Installer.php on line 33

Ocramius commented 4 years ago

Duplicate of #105

BTW, indeed, it could be a private const :+1:

NiklasBr commented 4 years ago

My composer requires looks like this:

  "require": {
    "php": ">=7.2",
    "ocramius/package-versions": "^1.2",

And now I get the same error as above:

niklas@Fractal:~/workspace/pimcore-dev$ php -v
PHP 7.2.24-0ubuntu0.18.04.4 (cli) (built: Apr  8 2020 15:45:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.24-0ubuntu0.18.04.4, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
niklas@Fractal:~/workspace/pimcore-dev$ composer update
PHP Parse error:  syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /home/niklas/workspace/pimcore-dev/vendor/ocramius/package-versions/src/PackageVersions/Installer.php on line 33

Parse error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /home/niklas/workspace/pimcore-dev/vendor/ocramius/package-versions/src/PackageVersions/Installer.php on line 33

Please consider being more kind to us ancient PHP 7.2 users!

Ocramius commented 4 years ago

please read the thread in #105, @NiklasBr: you probably aren't using composer update as you should.

NiklasBr commented 4 years ago

I did. I'm just asking to play nice with PHP 7.2 -- a version which is still actively supported and updated. Your repository. Your rules. One hundred percent. But really, using composer update is not the correct way to update Composer dependencies according to you?

Ocramius commented 4 years ago

not if you run the composer update on a system that isn't production-alike: I described that in the referenced issue, and you will be bitten again by it if you don't fix that.

NiklasBr commented 4 years ago

It was simple to resolve, I hope you can accept my PR.

necmettin commented 4 years ago

I know we don’t get a say in this but please make the code php7.2 compatible. This could easily be avoided by removing a single word, which changes nothing end-result-wise.

Ocramius commented 4 years ago

hey there, the code requires PHP 7.4, and that's the end of the story.

Ocramius commented 4 years ago

BTW, there are stable releases that support even older PHP 7.x versions.