Skip to content

Commit 8c3ba48

Browse files
authored
Merge pull request #1329 from thephpleague/fix-deprecation-notices-php-8
Fixes for Deprecation Notices in Test Suite
2 parents 539f434 + f4b65ec commit 8c3ba48

15 files changed

+141
-110
lines changed

.github/workflows/backwards-compatibility.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ jobs:
1414
uses: "actions/checkout@v2"
1515
with:
1616
fetch-depth: 0
17-
17+
- name: Fix git safe.directory in container
18+
run: mkdir -p /home/runner/work/_temp/_github_home && printf "[safe]\n\tdirectory = /github/workspace" > /home/runner/work/_temp/_github_home/.gitconfig
1819
- name: "Backwards Compatibility Check"
1920
uses: docker://nyholm/roave-bc-check-ga
2021
with:

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Fixed
9+
- Fix deprecation notices for PHP 8.x (PR #1329)
810

911
## [8.4.0] - released 2023-02-15
1012
### Added

examples/public/client_credentials.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,16 @@
5353
]);
5454

5555
$app->post('/access_token', function (ServerRequestInterface $request, ResponseInterface $response) use ($app) {
56-
5756
/* @var \League\OAuth2\Server\AuthorizationServer $server */
5857
$server = $app->getContainer()->get(AuthorizationServer::class);
5958

6059
try {
61-
6260
// Try to respond to the request
6361
return $server->respondToAccessTokenRequest($request, $response);
6462
} catch (OAuthServerException $exception) {
65-
6663
// All instances of OAuthServerException can be formatted into a HTTP response
6764
return $exception->generateHttpResponse($response);
6865
} catch (\Exception $exception) {
69-
7066
// Unknown exception
7167
$body = new Stream('php://temp', 'r+');
7268
$body->write($exception->getMessage());

examples/public/password.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
$app = new App([
1818
// Add the authorization server to the DI container
1919
AuthorizationServer::class => function () {
20-
2120
// Setup the authorization server
2221
$server = new AuthorizationServer(
2322
new ClientRepository(), // instance of ClientRepositoryInterface
@@ -46,20 +45,16 @@
4645
$app->post(
4746
'/access_token',
4847
function (ServerRequestInterface $request, ResponseInterface $response) use ($app) {
49-
5048
/* @var \League\OAuth2\Server\AuthorizationServer $server */
5149
$server = $app->getContainer()->get(AuthorizationServer::class);
5250

5351
try {
54-
5552
// Try to respond to the access token request
5653
return $server->respondToAccessTokenRequest($request, $response);
5754
} catch (OAuthServerException $exception) {
58-
5955
// All instances of OAuthServerException can be converted to a PSR-7 response
6056
return $exception->generateHttpResponse($response);
6157
} catch (\Exception $exception) {
62-
6358
// Catch unexpected exceptions
6459
$body = $response->getBody();
6560
$body->write($exception->getMessage());

phpunit.xml.dist

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit colors="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="true"
3-
stopOnFailure="true" stopOnIncomplete="false" stopOnSkipped="false" bootstrap="tests/Bootstrap.php">
2+
<phpunit
3+
colors="true"
4+
convertDeprecationsToExceptions="true"
5+
convertNoticesToExceptions="true"
6+
convertWarningsToExceptions="true"
7+
stopOnError="true"
8+
stopOnFailure="true"
9+
stopOnIncomplete="false"
10+
stopOnSkipped="false"
11+
bootstrap="tests/Bootstrap.php"
12+
>
413
<testsuites>
514
<testsuite name="Tests">
615
<directory>./tests/</directory>

src/Entities/Traits/ClientTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ trait ClientTrait
3030
* Get the client's name.
3131
*
3232
* @return string
33+
*
3334
* @codeCoverageIgnore
3435
*/
3536
public function getName()

src/Entities/Traits/ScopeTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ trait ScopeTrait
1616
*
1717
* @return string
1818
*/
19+
#[\ReturnTypeWillChange]
1920
public function jsonSerialize()
2021
{
2122
return $this->getIdentifier();

src/RequestAccessTokenEvent.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function __construct($name, ServerRequestInterface $request, AccessTokenE
3131

3232
/**
3333
* @return AccessTokenEntityInterface
34+
*
3435
* @codeCoverageIgnore
3536
*/
3637
public function getAccessToken()

src/RequestEvent.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function __construct($name, ServerRequestInterface $request)
4040

4141
/**
4242
* @return ServerRequestInterface
43+
*
4344
* @codeCoverageIgnore
4445
*/
4546
public function getRequest()

src/RequestRefreshTokenEvent.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function __construct($name, ServerRequestInterface $request, RefreshToken
3131

3232
/**
3333
* @return RefreshTokenEntityInterface
34+
*
3435
* @codeCoverageIgnore
3536
*/
3637
public function getRefreshToken()

0 commit comments

Comments
 (0)