parse icon indicating copy to clipboard operation
parse copied to clipboard

Syntax errors when running against PHP 7.1 codebase

Open NicolasCARPi opened this issue 7 years ago • 5 comments

Hello,

I'm discovering psecio-parse and I've just ran it on my codebase.

I've opened this issue to report errors when running it against a PHP 7.1 codebase:

private const MY_PRIVATE_CONST = 'hello';

^ this will throw an error "Syntax error, unexpected T_CONST, expecting T_FUNCTION"

public function hello(?string $name): string

^ this will throw an error "unexpected ?, expecting T_VARIABLE

I believe these errors come from nikic/php-parser, right? Your composer.json locks it to version 2.0 (resolving to 2.1.1 back from 2016) when version 4.0 is out and supports newer syntax. So maybe updating the parser would simply solve these issues.

Also, it would be great if you could provide phar archives for releases and don't limit the symfony/console dependency to version 3.2 max ;)

Cheers and I wish the best to this project! :)

~Nico

NicolasCARPi avatar Aug 06 '18 14:08 NicolasCARPi

@NicolasCARPi , please send PR for each of the things mentioned (3 PR in total if I'm not mistaken).

aik099 avatar Aug 06 '18 18:08 aik099

@aik099 I did a PR. But the result is not really what I hoped; see comment on PR ;)

NicolasCARPi avatar Aug 06 '18 22:08 NicolasCARPi

The main reason why PHP 7.1 code is not supported, is that this package used "nikic/php-parser": "^2.0" constraint. I suggest to upgrade it to at least 3.0; better will be 4.0

llaville avatar Nov 28 '19 08:11 llaville

@llaville Indeed. Unfortunately, this project seems abandoned anyway.

NicolasCARPi avatar Nov 28 '19 11:11 NicolasCARPi

@NicolasCARPi Bad news to hear !

llaville avatar Nov 28 '19 12:11 llaville