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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.