sebastianbergmann/phpcpd

syntax error in the .phar archive

Closed this issue · 3 comments

I downloaded the .phar archive as described in the README in this repo.

When run, I get the following error:

`PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in phar:///usr/local/bin/phpcpd/src/CLI/Application.php on line 99

oh I see. it works in a server with PHP 7.2 on it, but not PHP 5.6

it only works in PHP 7, because of how you're defining disableXdebug
private function disableXdebug(): void

I've never seen that before in PHP, and don't see it in the online documentation.

aboks commented

I've never seen that before in PHP, and don't see it in the online documentation.

The void return type was added in PHP 7.1, see http://php.net/manual/en/migration71.new-features.php#migration71.new-features.void-functions.

it only works in PHP 7 [...]

PHPCPD version 4 requires at least PHP 7.1. This is not explicitly stated in the readme, but can be found in composer.json: https://github.com/sebastianbergmann/phpcpd/blob/4.0.0/composer.json#L25. I would strongly recommend to upgrade to at least PHP 7.1 anyway, since older versions are not supported anymore (http://php.net/supported-versions.php).

However it is explicitly stated in https://github.com/sebastianbergmann/phpcpd/blob/master/build/phar-autoload.php.in to be compatible with php 5.6.

Given that these are the first lines anyone opening the phar file reads. maybe the should be adjusted?