Skip to content

Commit 08d54e4

Browse files
committed
PHP 8.
1 parent 21d9836 commit 08d54e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+383
-764
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ composer.lock
66
Thumbs.db
77
/*.php
88
sftp-config.json
9-
.php_cs.cache
9+
*.cache

.phpunit.result.cache

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
C:37:"PHPUnit\Runner\DefaultTestResultCache":1272:{a:2:{s:7:"defects";a:6:{s:50:"Providers\FeiShuTest::testProviderCanCreateCorrect";i:3;s:50:"Providers\FeiShuTest::testConfigAppAccessTokenWork";i:4;s:90:"Providers\FeiShuTest::testConfigAppAccessTokenWithDefaultModeAndAppTicketWorkInBadResponse";i:3;s:91:"Providers\FeiShuTest::testConfigAppAccessTokenWithDefaultModeAndAppTicketWorkInGoodResponse";i:4;s:71:"Providers\FeiShuTest::testConfigAppAccessTokenWithInternalInBadResponse";i:3;s:72:"Providers\FeiShuTest::testConfigAppAccessTokenWithInternalInGoodResponse";i:4;}s:5:"times";a:9:{s:50:"Providers\FeiShuTest::testProviderCanCreateCorrect";d:0.003;s:57:"Providers\FeiShuTest::testProviderWithInternalAppModeWork";d:0;s:51:"Providers\FeiShuTest::testProviderWithAppTicketWork";d:0;s:50:"Providers\FeiShuTest::testConfigAppAccessTokenWork";d:0.003;s:76:"Providers\FeiShuTest::testConfigAppAccessTokenWithDefaultModeNoAppTicketWork";d:0.003;s:90:"Providers\FeiShuTest::testConfigAppAccessTokenWithDefaultModeAndAppTicketWorkInBadResponse";d:0.002;s:91:"Providers\FeiShuTest::testConfigAppAccessTokenWithDefaultModeAndAppTicketWorkInGoodResponse";d:0;s:71:"Providers\FeiShuTest::testConfigAppAccessTokenWithInternalInBadResponse";d:0;s:72:"Providers\FeiShuTest::testConfigAppAccessTokenWithInternalInGoodResponse";d:0;}}}
1+
{"version":1,"defects":{"OAuthTest::test_it_can_get_token":4,"OAuthTest::test_it_can_get_user_by_code":4,"WechatTest::testWeChatProviderHasCorrectlyRedirectResponse":6},"times":{"OAuthTest::test_it_can_get_auth_url_without_redirect":0.003,"OAuthTest::test_it_can_get_auth_url_with_redirect":0,"OAuthTest::test_it_can_get_auth_url_with_scopes":0,"OAuthTest::test_it_can_get_auth_url_with_state":0,"OAuthTest::test_it_can_get_token":0.01,"OAuthTest::test_it_can_get_user_by_token":0,"OAuthTest::test_it_can_get_user_by_code":0,"Providers\\FeiShuTest::testProviderCanCreateCorrect":0.001,"Providers\\FeiShuTest::testProviderWithInternalAppModeWork":0,"Providers\\FeiShuTest::testProviderWithAppTicketWork":0,"Providers\\FeiShuTest::testConfigAppAccessTokenWithDefaultModeNoAppTicketWork":0.003,"Providers\\FeiShuTest::testConfigAppAccessTokenWithDefaultModeAndAppTicketWorkInBadResponse":0.003,"Providers\\FeiShuTest::testConfigAppAccessTokenWithDefaultModeAndAppTicketWorkInGoodResponse":0,"Providers\\FeiShuTest::testConfigAppAccessTokenWithInternalInBadResponse":0,"Providers\\FeiShuTest::testConfigAppAccessTokenWithInternalInGoodResponse":0,"WeWorkTest::testQrConnect":0,"WeWorkTest::testOAuthWithAgentId":0,"WeWorkTest::testOAuthWithoutAgentId":0,"WechatTest::testWeChatProviderHasCorrectlyRedirectResponse":0.001,"WechatTest::testWeChatProviderTokenUrlAndRequestFields":0,"WechatTest::testOpenPlatformComponent":0,"WechatTest::testOpenPlatformComponentWithCustomParameters":0,"SocialiteManagerTest::test_it_can_create_from_config":0.003,"SocialiteManagerTest::test_it_can_create_from_custom_creator":0,"SocialiteManagerTest::test_it_can_create_from_custom_provider_class":0,"UserTest::testJsonserialize":0,"UserTest::test_it_can_get_refresh_token":0,"UserTest::test_it_can_set_raw_data":0,"UserTest::test_ie_can_get_attribute_by_magic_method":0}}

.travis.yml

-13
This file was deleted.

LICENSE.txt LICENSE

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) overtrue <[email protected]>
3+
Copyright (c) 2021 overtrue <[email protected]>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

12-
The above copyright notice and this permission notice shall be included in
13-
all copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
<h1 align="center"> Socialite</h1>
2-
<p align="center">
3-
<a href="https://packagist.org/packages/overtrue/socialite"><img src="https://poser.pugx.org/overtrue/socialite/v/stable.svg" alt="Latest Stable Version"></a>
4-
<a href="https://packagist.org/packages/overtrue/socialite"><img src="https://poser.pugx.org/overtrue/socialite/v/unstable.svg" alt="Latest Unstable Version"></a>
5-
<a href="https://scrutinizer-ci.com/g/overtrue/socialite/build-status/master"><img src="https://scrutinizer-ci.com/g/overtrue/socialite/badges/build.png?b=master" alt="Build Status"></a>
6-
<a href="https://packagist.org/packages/overtrue/socialite"><img src="https://poser.pugx.org/overtrue/socialite/downloads" alt="Total Downloads"></a>
7-
<a href="https://packagist.org/packages/overtrue/socialite"><img src="https://poser.pugx.org/overtrue/socialite/license" alt="License"></a>
8-
</p>
1+
# Socialite
92

3+
Socialite is an [OAuth2](https://oauth.net/2/) Authentication tool. It is inspired by [laravel/socialite](https://github.com/laravel/socialite), You can easily use it in any PHP project. [中文文档](/README_CN.md)
104

11-
<p align="center">Socialite is an <a href="https://oauth.net/2/">OAuth2</a> Authentication tool. It is inspired by <a href="https://github.com/laravel/socialite">laravel/socialite</a>, You can easily use it in any PHP project. <a href="/README_CN.md">中文文档</a></p>
12-
13-
<p align="center">This tool now supports platforms such as Facebook, GitHub, Google, LinkedIn, Outlook, QQ, Tapd, Alipay, Taobao, Baidu, DingTalk, Weibo, WeChat, Douyin, Feishu, Douban, WeWork, Tencent Cloud, Line, Gitee.</p>
5+
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/overtrue/laravel-socialite?style=flat-square)
6+
![GitHub License](https://img.shields.io/github/license/overtrue/laravel-socialite?style=flat-square)
7+
![Packagist Downloads](https://img.shields.io/packagist/dt/overtrue/laravel-socialite?style=flat-square)
148

159
[![Sponsor me](https://github.com/overtrue/overtrue/blob/master/sponsor-me-button-s.svg?raw=true)](https://github.com/sponsors/overtrue)
1610

17-
如果你喜欢我的项目并想支持它,[点击这里 :heart:](https://github.com/sponsors/overtrue)
11+
This tool now supports platforms such as Facebook, GitHub, Google, LinkedIn, Outlook, QQ, Tapd, Alipay, Taobao, Baidu, DingTalk, Weibo, WeChat, Douyin, Feishu, Douban, WeWork, Tencent Cloud, Line, Gitee.
1812

13+
如果你喜欢我的项目并想支持它,[点击这里 :heart:](https://github.com/sponsors/overtrue)
1914

2015
- [Requirement](#requirement)
2116
- [Installation](#installation)
@@ -51,7 +46,7 @@
5146
# Requirement
5247

5348
```
54-
PHP >= 7.4
49+
PHP >= 8.0.2
5550
```
5651
# Installation
5752

README_CN.md

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
<h1 align="center"> Socialite</h1>
2-
<p align="center">
3-
<a href="https://packagist.org/packages/overtrue/socialite"><img src="https://poser.pugx.org/overtrue/socialite/v/stable.svg" alt="Latest Stable Version"></a>
4-
<a href="https://packagist.org/packages/overtrue/socialite"><img src="https://poser.pugx.org/overtrue/socialite/v/unstable.svg" alt="Latest Unstable Version"></a>
5-
<a href="https://scrutinizer-ci.com/g/overtrue/socialite/build-status/master"><img src="https://scrutinizer-ci.com/g/overtrue/socialite/badges/build.png?b=master" alt="Build Status"></a>
6-
<a href="https://scrutinizer-ci.com/g/overtrue/socialite/?branch=master"><img src="https://scrutinizer-ci.com/g/overtrue/socialite/badges/quality-score.png?b=master" alt="Scrutinizer Code Quality"></a>
7-
<a href="https://scrutinizer-ci.com/g/overtrue/socialite/?branch=master"><img src="https://scrutinizer-ci.com/g/overtrue/socialite/badges/coverage.png?b=master" alt="Code Coverage"></a>
8-
<a href="https://packagist.org/packages/overtrue/socialite"><img src="https://poser.pugx.org/overtrue/socialite/downloads" alt="Total Downloads"></a>
9-
<a href="https://packagist.org/packages/overtrue/socialite"><img src="https://poser.pugx.org/overtrue/socialite/license" alt="License"></a>
10-
</p>
1+
# Socialite
112

3+
Socialite 是一个 [OAuth2](https://oauth.net/2/) 认证工具。 它的灵感来源于 [laravel/socialite](https://github.com/laravel/socialite) , 你可以很轻易的在任何 PHP 项目中使用它。
124

13-
<p align="center">Socialite 是一个 <a href="https://oauth.net/2/">OAuth2</a> 认证工具。 它的灵感来源于 <a href="https://github.com/laravel/socialite">laravel/socialite</a>, 你可以很轻易的在任何 PHP 项目中使用它。</p>
5+
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/overtrue/laravel-socialite?style=flat-square)
6+
![GitHub License](https://img.shields.io/github/license/overtrue/laravel-socialite?style=flat-square)
7+
![Packagist Downloads](https://img.shields.io/packagist/dt/overtrue/laravel-socialite?style=flat-square)
148

15-
<p align="center">该工具现已支持平台有:Facebook,Github,Google,Linkedin,Outlook,QQ,TAPD,支付宝,淘宝,百度,钉钉,微博,微信,抖音,飞书,豆瓣,企业微信,腾讯云,Line,Gitee。</p>
9+
[![Sponsor me](https://github.com/overtrue/overtrue/blob/master/sponsor-me-button-s.svg?raw=true)](https://github.com/sponsors/overtrue)
10+
11+
该工具现已支持平台有:Facebook,Github,Google,Linkedin,Outlook,QQ,TAPD,支付宝,淘宝,百度,钉钉,微博,微信,抖音,飞书,豆瓣,企业微信,腾讯云,Line,Gitee。
1612

1713
- [版本要求](#版本要求)
1814
- [安装](#安装)
@@ -48,7 +44,7 @@
4844
# 版本要求
4945

5046
```
51-
PHP >= 7.4
47+
PHP >= 8.0.2
5248
```
5349

5450
# 安装

composer.json

+9-8
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@
1717
}
1818
},
1919
"require": {
20-
"php": ">=7.4",
21-
"symfony/http-foundation": "^5.0",
22-
"guzzlehttp/guzzle": "~6.0|~7.0",
20+
"php": ">=8.0.2",
2321
"ext-json": "*",
24-
"symfony/psr-http-message-bridge": "^2.0",
25-
"ext-openssl": "*"
22+
"ext-openssl": "*",
23+
"guzzlehttp/guzzle": "^7.0",
24+
"symfony/http-foundation": "^6.0",
25+
"symfony/psr-http-message-bridge": "^2.1"
2626
},
2727
"require-dev": {
28-
"mockery/mockery": "~1.2",
29-
"phpunit/phpunit": "~9.0",
30-
"friendsofphp/php-cs-fixer": "^3.0"
28+
"friendsofphp/php-cs-fixer": "^3.0",
29+
"mockery/mockery": "^1.3",
30+
"phpunit/phpunit": "^9.0",
31+
"jetbrains/phpstorm-attributes": "^1.0"
3132
},
3233
"license": "MIT",
3334
"authors": [

src/Config.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -86,27 +86,27 @@ public function has(string $key): bool
8686
return (bool) $this->get($key);
8787
}
8888

89-
public function offsetExists($offset)
89+
public function offsetExists(mixed $offset): bool
9090
{
9191
return array_key_exists($offset, $this->config);
9292
}
9393

94-
public function offsetGet($offset)
94+
public function offsetGet(mixed $offset): mixed
9595
{
9696
return $this->get($offset);
9797
}
9898

99-
public function offsetSet($offset, $value)
99+
public function offsetSet(mixed $offset, $value): void
100100
{
101101
$this->set($offset, $value);
102102
}
103103

104-
public function offsetUnset($offset)
104+
public function offsetUnset(mixed $offset): void
105105
{
106106
$this->set($offset, null);
107107
}
108108

109-
public function jsonSerialize()
109+
public function jsonSerialize(): mixed
110110
{
111111
return $this->config;
112112
}

src/Contracts/ProviderInterface.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
namespace Overtrue\Socialite\Contracts;
44

5-
use Overtrue\Socialite\User;
6-
75
interface ProviderInterface
86
{
97
public function redirect(?string $redirectUrl = null): string;
108

11-
public function userFromCode(string $code): User;
9+
public function userFromCode(string $code): UserInterface;
1210

13-
public function userFromToken(string $token): User;
11+
public function userFromToken(string $token): UserInterface;
1412
}

src/Contracts/UserInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
interface UserInterface
66
{
7-
public function getId();
7+
public function getId(): mixed;
88

99
public function getNickname(): ?string;
1010

src/Exceptions/AuthorizeFailedException.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
namespace Overtrue\Socialite\Exceptions;
44

5+
use JetBrains\PhpStorm\Pure;
6+
57
class AuthorizeFailedException extends Exception
68
{
79
public array $body;
810

9-
/**
10-
* @param string $message
11-
* @param array $body
12-
*/
13-
public function __construct(string $message, $body)
11+
#[Pure]
12+
public function __construct(string $message, mixed $body)
1413
{
1514
parent::__construct($message, -1);
1615

src/Exceptions/BadRequestException.php

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
namespace Overtrue\Socialite\Exceptions;
44

5-
/**
6-
* Class BadRequestException.
7-
*/
85
class BadRequestException extends Exception
96
{
107
}

src/Exceptions/Feishu/InvalidTicketException.php

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
use Overtrue\Socialite\Exceptions\Exception;
66

7-
/**
8-
* Class BadRequestException.
9-
*/
107
class InvalidTicketException extends Exception
118
{
129
}

src/Exceptions/InvalidTokenException.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
namespace Overtrue\Socialite\Exceptions;
44

5+
use JetBrains\PhpStorm\Pure;
6+
57
class InvalidTokenException extends Exception
68
{
79
public string $token;
810

9-
/**
10-
* @param string $message
11-
* @param string $token
12-
*/
11+
#[Pure]
1312
public function __construct(string $message, string $token)
1413
{
1514
parent::__construct($message, -1);

0 commit comments

Comments
 (0)