use GuzzleHttp\Psr7\Request;
use Laminas\Diactoros\Response\RedirectResponse;
+use Psr\Http\Message\ResponseInterface;
use wcf\data\user\User;
use wcf\form\AccountManagementForm;
use wcf\form\RegisterForm;
/**
* @inheritDoc
*/
- protected function processUser(OauthUser $oauthUser)
+ protected function processUser(OauthUser $oauthUser): ResponseInterface
{
$user = User::getUserByAuthData('facebook:' . $oauthUser->getId());
use GuzzleHttp\Psr7\Request;
use Laminas\Diactoros\Response\RedirectResponse;
use Psr\Http\Client\ClientExceptionInterface;
+use Psr\Http\Message\ResponseInterface;
use wcf\data\user\User;
use wcf\form\AccountManagementForm;
use wcf\form\RegisterForm;
/**
* @inheritDoc
*/
- protected function processUser(OauthUser $oauthUser)
+ protected function processUser(OauthUser $oauthUser): ResponseInterface
{
$user = User::getUserByAuthData('github:' . $oauthUser->getId());
use GuzzleHttp\Psr7\Request;
use Laminas\Diactoros\Response\RedirectResponse;
+use Psr\Http\Message\ResponseInterface;
use wcf\data\user\User;
use wcf\form\AccountManagementForm;
use wcf\form\RegisterForm;
*/
private function getConfiguration()
{
- if (!$this->configuration) {
+ if (!isset($this->configuration)) {
$request = new Request('GET', 'https://accounts.google.com/.well-known/openid-configuration');
$response = $this->getHttpClient()->send($request);
/**
* @inheritDoc
*/
- protected function processUser(OauthUser $oauthUser)
+ protected function processUser(OauthUser $oauthUser): ResponseInterface
{
$user = User::getUserByAuthData('google:' . $oauthUser->getId());
use ParagonIE\ConstantTime\Base64;
use ParagonIE\ConstantTime\Hex;
use Psr\Http\Client\ClientExceptionInterface;
+use Psr\Http\Message\ResponseInterface;
use wcf\data\user\User;
use wcf\form\RegisterForm;
use wcf\system\event\EventHandler;
*/
public $neededModules = ['TWITTER_PUBLIC_KEY', 'TWITTER_PRIVATE_KEY'];
- /**
- * @var ClientInterface
- */
- private $httpClient;
+ private ClientInterface $httpClient;
/**
* @inheritDoc
/**
* @inheritDoc
*/
- public function execute()
+ public function execute(): ResponseInterface
{
parent::execute();
/**
* Processes the user (e.g. by registering session variables and redirecting somewhere).
*/
- protected function processUser(OauthUser $oauthUser)
+ protected function processUser(OauthUser $oauthUser): ResponseInterface
{
$user = User::getUserByAuthData('twitter:' . $oauthUser->getId());
/**
* Initiates the OAuth flow by redirecting to the '/authenticate' URL.
*/
- private function initiate()
+ private function initiate(): ResponseInterface
{
$data = $this->getRequestToken();
* Builds the OAuth authorization header.
*
* @param array $parameters
- * @return string
*/
- public function buildOAuthHeader(array $parameters)
+ public function buildOAuthHeader(array $parameters): string
{
$header = '';
foreach ($parameters as $key => $val) {
/**
* Creates an OAuth 1 signature.
- *
- * @param string $url
- * @param array $parameters
- * @param string $tokenSecret
- * @param string $method
- * @return string
*/
public function createSignature(
- $url,
+ string $url,
array $parameters,
#[\SensitiveParameter]
- $tokenSecret = '',
- $method = 'POST'
- ) {
+ string $tokenSecret = '',
+ string $method = 'POST'
+ ): string {
$tmp = [];
foreach ($parameters as $key => $val) {
$tmp[\rawurlencode($key)] = \rawurlencode($val);
*/
final protected function getHttpClient(): ClientInterface
{
- if (!$this->httpClient) {
+ if (!isset($this->httpClient)) {
$this->httpClient = HttpFactory::makeClientWithTimeout(5);
}