Skip to content

Commit e7e6ec4

Browse files
committed
tmp php 8
1 parent 78c565f commit e7e6ec4

File tree

126 files changed

+1185
-2565
lines changed

Some content is hidden

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

126 files changed

+1185
-2565
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-20.04
1010
strategy:
1111
matrix:
12-
php: [ '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
12+
php: [ '8.0', '8.1', '8.2', '8.3', '8.4' ]
1313
steps:
1414
- uses: actions/checkout@v2
1515
- run: mkdir -p build/logs

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# CHANGELOG
22

3+
## 8.x (UNOFFICIAL)
4+
- 8.0.0
5+
- Require PHP 8.0.
6+
- `GraphObject`, `GraphList` and `GraphObjectFactory` have been removed. Replaced by `GraphNode`, `GraphEdge` and `GraphNodeFactory`.
7+
- Methods that return `bool|null` now always return `bool` and default to `false` instead.
8+
- `AccessTokenMetaData`:
9+
- Removed deprecated `getProperty` function. Use `getField`.
10+
- `Collection`:
11+
- Removed deprecated `getProperty` function. Use `getField`.
12+
- Removed deprecated `getPropertyNames` function. Use `getFieldNames`.
13+
- `FacebookResponse`:
14+
- Removed deprecated `getGraphList` function. Use `getGraphEdge`.
15+
- `FacebookApp`:
16+
- 32 bit systems now *must* provide their app ID as a string.
17+
- Removed `mcrypt` as option for `createPseudoRandomStringGenerator`.
18+
- Removed `McryptPseudoRandomStringGenerator` as `mcrypt_create_iv` was removed in PHP 7.2.
19+
- All random string generators now type-check their `length` parameter instead of relying on a validation method and exception.
20+
321
## 7.x (UNOFFICIAL)
422
- 7.0.1
523
- Add `conflict` section to `composer.json` to prevent incompatible versions of Guzzle.

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
}
1313
],
1414
"require": {
15-
"php": "^7.3 || ^8.0"
15+
"php": "^8.0"
1616
},
1717
"require-dev": {
1818
"phpunit/phpunit": "~9.5",
19-
"mockery/mockery": "~1.5.1",
20-
"guzzlehttp/guzzle": "^6.5.0 | ^7.5.0"
19+
"mockery/mockery": "~1.6.12",
20+
"guzzlehttp/guzzle": "^7.9.2",
21+
"ext-mongodb": "*"
2122
},
2223
"conflict": {
2324
"guzzlehttp/guzzle": "<6.0"

docs/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ There are two methods to install the Facebook SDK for PHP. The recommended insta
2222
[Composer](https://getcomposer.org/) is the recommended way to install the Facebook SDK for PHP. Simply run the following in the root of your project.
2323

2424
```
25-
composer require facebook/graph-sdk
25+
composer require nickdnk/graph-sdk
2626
```
2727

2828
> The Facebook SDK starting adhering to [SemVer](http://semver.org/) with version 5. Previous to version 5, the SDK did not follow SemVer.

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" stderr="true"
33
convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true"
44
convertDeprecationsToExceptions="true"
5-
stopOnFailure="true" bootstrap="tests/bootstrap.php"
5+
stopOnFailure="false" bootstrap="tests/bootstrap.php"
66
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
77
<coverage>
88
<include>

src/Facebook/Authentication/AccessToken.php

Lines changed: 19 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
*/
2424
namespace Facebook\Authentication;
2525

26+
use DateTime;
27+
2628
/**
2729
* Class AccessToken
2830
*
@@ -35,22 +37,19 @@ class AccessToken
3537
*
3638
* @var string
3739
*/
38-
protected $value = '';
40+
protected string $value = '';
3941

4042
/**
4143
* Date when token expires.
4244
*
43-
* @var \DateTime|null
45+
* @var DateTime|null
4446
*/
45-
protected $expiresAt;
47+
protected ?DateTime $expiresAt = null;
4648

4749
/**
4850
* Create a new access token entity.
49-
*
50-
* @param string $accessToken
51-
* @param int $expiresAt
5251
*/
53-
public function __construct($accessToken, $expiresAt = 0)
52+
public function __construct(string $accessToken, int $expiresAt = 0)
5453
{
5554
$this->value = $accessToken;
5655
if ($expiresAt) {
@@ -65,73 +64,61 @@ public function __construct($accessToken, $expiresAt = 0)
6564
*
6665
* @return string
6766
*/
68-
public function getAppSecretProof($appSecret)
67+
public function getAppSecretProof(string $appSecret): string
6968
{
7069
return hash_hmac('sha256', $this->value, $appSecret);
7170
}
7271

7372
/**
7473
* Getter for expiresAt.
7574
*
76-
* @return \DateTime|null
75+
* @return DateTime|null
7776
*/
78-
public function getExpiresAt()
77+
public function getExpiresAt(): ?DateTime
7978
{
8079
return $this->expiresAt;
8180
}
8281

8382
/**
8483
* Determines whether or not this is an app access token.
85-
*
86-
* @return bool
8784
*/
88-
public function isAppAccessToken()
85+
public function isAppAccessToken(): bool
8986
{
90-
return strpos($this->value, '|') !== false;
87+
return str_contains($this->value, '|');
9188
}
9289

9390
/**
9491
* Determines whether or not this is a long-lived token.
9592
*
9693
* @return bool
9794
*/
98-
public function isLongLived()
95+
public function isLongLived(): bool
9996
{
10097
if ($this->expiresAt) {
10198
return $this->expiresAt->getTimestamp() > time() + (60 * 60 * 2);
10299
}
103100

104-
if ($this->isAppAccessToken()) {
105-
return true;
106-
}
101+
return $this->isAppAccessToken();
107102

108-
return false;
109103
}
110104

111105
/**
112106
* Checks the expiration of the access token.
113-
*
114-
* @return boolean|null
115107
*/
116-
public function isExpired()
108+
public function isExpired(): bool
117109
{
118-
if ($this->getExpiresAt() instanceof \DateTime) {
110+
if ($this->getExpiresAt() instanceof DateTime) {
119111
return $this->getExpiresAt()->getTimestamp() < time();
120112
}
121113

122-
if ($this->isAppAccessToken()) {
123-
return false;
124-
}
114+
return false;
125115

126-
return null;
127116
}
128117

129118
/**
130119
* Returns the access token as a string.
131-
*
132-
* @return string
133120
*/
134-
public function getValue()
121+
public function getValue(): string
135122
{
136123
return $this->value;
137124
}
@@ -146,14 +133,9 @@ public function __toString()
146133
return $this->getValue();
147134
}
148135

149-
/**
150-
* Setter for expires_at.
151-
*
152-
* @param int $timeStamp
153-
*/
154-
protected function setExpiresAtFromTimeStamp($timeStamp)
136+
protected function setExpiresAtFromTimeStamp(int $timeStamp): void
155137
{
156-
$dt = new \DateTime();
138+
$dt = new DateTime();
157139
$dt->setTimestamp($timeStamp);
158140
$this->expiresAt = $dt;
159141
}

0 commit comments

Comments
 (0)