我在 PHP 的 TwitterOAuth 库中遇到语法错误。我收到的错误信息是:
解析错误:语法错误,意外的')',期待变量 (T_VARIABLE) 在第 58 行的 TwitterOAuth.php 中
这是你需要知道的:
Error Type: Syntax error, indicating an issue with the code's structure or grammar.
Affected File: TwitterOAuth.php.
Line Number: Line 58.
Context or Relevant Code Snippet:
[Include the code snippet around line 58 in TwitterOAuth.php].
我已经检查了我的代码是否有任何明显的语法错误,并且我已经在网上搜索了解决方案,但我找不到任何具体的。
对于如何解决此语法错误并成功使用 TwitterOAuth 库的任何见解或建议,我将不胜感激。
感谢您的帮助!
这是该库的第 52-58 行:
public function __construct(
string $consumerKey,
string $consumerSecret,
?string $oauthToken = null,
?string $oauthTokenSecret = null,
) {
我的猜测是尾随逗号是添加到比您正在使用的版本更新的PHP版本中的一项功能。
该库似乎需要 PHP 8。