Reputation: 63
I'm willing to use the ComposerAPI (https://github.com/kabachello/ComposerAPI) Package for my Project. But I got this error message with PHP 5.6
Parse error: syntax error, unexpected 'require' (T_REQUIRE), expecting identifier (T_STRING) in ComposerAPI.php on line 203
With PHP 7.0 it's working fine. Can anybody help me ?
Thanks.
Upvotes: 5
Views: 2907
Reputation: 19764
The name of the function at this line is "require"
:
public function require(array $package_names, array $options = null, OutputInterface $output = null){ }
PHP 5 doesn't allow to use reserved keyword as function name.
As of PHP 7, the interpreter understands that is not the require()
function but a method of the class.
The Documentation said :
As of PHP 7.0.0 these keywords are allowed as property, constant, and method names of classes, interfaces and traits, except that class may not be used as constant name.
So, this code cannot be used with PHP before the version 7.0.
Upvotes: 2