From 8713c4035ea553046d795250165d0134a96f175c Mon Sep 17 00:00:00 2001 From: darthmaim Date: Wed, 7 Feb 2024 13:08:18 +0100 Subject: [PATCH 1/3] Fix warning of `IPaginatedEndpoint::batch` signature Fixes #136 --- src/V2/Pagination/IPaginatedEndpoint.php | 2 +- src/V2/Pagination/PaginatedEndpoint.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/V2/Pagination/IPaginatedEndpoint.php b/src/V2/Pagination/IPaginatedEndpoint.php index 562748d..e2ccdba 100644 --- a/src/V2/Pagination/IPaginatedEndpoint.php +++ b/src/V2/Pagination/IPaginatedEndpoint.php @@ -30,5 +30,5 @@ function page( $page, $size = null ); * @param callable $callback * @return void */ - function batch( $parallelRequests = null, callable $callback ); + function batch( $parallelRequests, $callback = null ); } diff --git a/src/V2/Pagination/PaginatedEndpoint.php b/src/V2/Pagination/PaginatedEndpoint.php index c7760b0..8878fa4 100644 --- a/src/V2/Pagination/PaginatedEndpoint.php +++ b/src/V2/Pagination/PaginatedEndpoint.php @@ -81,7 +81,7 @@ public function page( $page, $size = null ) { * @param callable $callback * @return void */ - public function batch( $parallelRequests = null, callable $callback = null ) { + public function batch( $parallelRequests, $callback = null ) { /** @noinspection PhpParamsInspection */ if( !isset( $callback ) && is_callable( $parallelRequests )) { $callback = $parallelRequests; From 0a528d0f03ec8c09bbe2c5052f00ab2d0d9ab2f7 Mon Sep 17 00:00:00 2001 From: darthmaim Date: Wed, 7 Feb 2024 13:35:33 +0100 Subject: [PATCH 2/3] Fix PHP 8.3 deprecation warning in ApiException Optional parameter $message declared before required parameter $response is implicitly treated as a required parameter in /home/runner/work/gw2api/gw2api/src/Exception/ApiException.php on line 12 --- src/Exception/ApiException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Exception/ApiException.php b/src/Exception/ApiException.php index 4c356f1..944023d 100644 --- a/src/Exception/ApiException.php +++ b/src/Exception/ApiException.php @@ -9,7 +9,7 @@ class ApiException extends Exception { /** @var ResponseInterface $response */ protected $response; - public function __construct( $message = "", ResponseInterface $response ) { + public function __construct( $message, ResponseInterface $response ) { $this->response = $response; parent::__construct( $message, $response->getStatusCode() ); From 86ca0ac76902c44832e2d14e04f42470722caf31 Mon Sep 17 00:00:00 2001 From: darthmaim Date: Wed, 7 Feb 2024 13:40:11 +0100 Subject: [PATCH 3/3] Fix PHP 8.2 deprecation warning in endpoint stubs PHP Deprecated: Creation of dynamic property Stubs\BulkEndpointStub::$supportsIdsAll is deprecated in /home/runner/work/gw2api/gw2api/tests/Stubs/BulkEndpointStub.php on line 13 --- tests/Stubs/BulkEndpointStub.php | 6 ++++++ tests/Stubs/PaginatedEndpointStub.php | 3 +++ 2 files changed, 9 insertions(+) diff --git a/tests/Stubs/BulkEndpointStub.php b/tests/Stubs/BulkEndpointStub.php index d2ca846..a7c7d7e 100644 --- a/tests/Stubs/BulkEndpointStub.php +++ b/tests/Stubs/BulkEndpointStub.php @@ -8,6 +8,12 @@ class BulkEndpointStub extends EndpointStub implements IBulkEndpoint { use BulkEndpoint; + + /** @var bool $supportsIdsAll */ + protected $supportsIdsAll = false; + + /** @var int $maxPageSize */ + protected $maxPageSize = false; public function __construct( GW2Api $api, $supportsIdsAll, $maxPageSize ) { $this->supportsIdsAll = $supportsIdsAll; diff --git a/tests/Stubs/PaginatedEndpointStub.php b/tests/Stubs/PaginatedEndpointStub.php index 5b52e76..83be498 100644 --- a/tests/Stubs/PaginatedEndpointStub.php +++ b/tests/Stubs/PaginatedEndpointStub.php @@ -9,6 +9,9 @@ class PaginatedEndpointStub extends EndpointStub implements IPaginatedEndpoint { use PaginatedEndpoint; + /** @var int $maxPageSize */ + protected $maxPageSize = false; + public function __construct( GW2Api $api, $maxPageSize = 10 ) { parent::__construct( $api );