解析错误:第 58 行 TwitterOAuth.php 中出现意外的 ')' - 需要帮助解决语法错误 [重复]

问题描述 投票:0回答:1

我在 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 库的任何见解或建议,我将不胜感激。

感谢您的帮助!

php parsing twitter syntax-error
1个回答
0
投票

这是该库的第 52-58 行:

来源

    public function __construct(
        string $consumerKey,
        string $consumerSecret,
        ?string $oauthToken = null,
        ?string $oauthTokenSecret = null,
    ) {

我的猜测是尾随逗号是添加到比您正在使用的版本更新的PHP版本中的一项功能。

该库似乎需要 PHP 8。

© www.soinside.com 2019 - 2024. All rights reserved.