Skip to content

Commit

Permalink
Merge pull request #137 from GW2Treasures/fix/paginated-endpoint-batc…
Browse files Browse the repository at this point in the history
…h-signature-warning
  • Loading branch information
darthmaim authored Feb 7, 2024
2 parents 44859f9 + 86ca0ac commit c4770ca
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Exception/ApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down
2 changes: 1 addition & 1 deletion src/V2/Pagination/IPaginatedEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
2 changes: 1 addition & 1 deletion src/V2/Pagination/PaginatedEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions tests/Stubs/BulkEndpointStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions tests/Stubs/PaginatedEndpointStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down

0 comments on commit c4770ca

Please sign in to comment.