タイトル通り、Githubでこちらをダウンロードしたのですが、TwitterOAuth.phpでシンタックスエラーが出てしまいます。
エラーの部分と内容
php
1namespace Abraham\TwitterOAuth; 2 3use Abraham\TwitterOAuth\{ 4 Consumer, 5 HmacSha1, 6 Response, 7 Token, 8 Util\JsonDecoder, 9};
上で「予期しない『}』です」というエラーが出ます。こちらは『Util\JsonDecoder,』のカンマを消して対応できますが、カンマを消しても今度は
php
1class TwitterOAuth extends Config 2{ 3 private const API_HOST = 'https://api.twitter.com'; 4 private const UPLOAD_HOST = 'https://upload.twitter.com'; 5 6 /** @var Response details about the result of the last request */ 7 private ?Response $response = null; 8
の部分で「予期しない『?』です」とエラーになります。この『?』を消すと「Default value for property of type Abraham\TwitterOAuth\Response may not be null. Use the nullable type ?Abraham\TwitterOAuth\Response to allow null default value」とエラーメッセージが出ます。
利用サーバー
xfreeの「php・mysqlサーバー」です。
php.ini設定は『エラー設定』『セッション設定』『文字コード設定』以外触れません。
どうすればエラーを消してTwitterAPIを利用できるでしょうか。
よろしくお願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。