Skip to content

Commit

Permalink
Fixes coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoray authored and github-actions[bot] committed Dec 5, 2024
1 parent 34f8dd5 commit 02ca3a2
Show file tree
Hide file tree
Showing 41 changed files with 56 additions and 67 deletions.
2 changes: 1 addition & 1 deletion src/Http/Requests/GetAllMethodsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GetAllMethodsRequest extends ResourceHydratableRequest

public function __construct(?GetAllMethodsQuery $query = null)
{
$this->query = $query ?: new GetAllMethodsQuery();
$this->query = $query ?: new GetAllMethodsQuery;
}

protected function defaultQuery(): array
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/CursorCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ abstract class CursorCollection extends ResourceCollection
* Return the next set of resources when available
*
* @return null|CursorCollection|Response
*
* @throws \Mollie\Api\Exceptions\ApiException
*/
public function next()
Expand All @@ -27,6 +28,7 @@ public function next()
* Return the previous set of resources when available
*
* @return null|CursorCollection|Response
*
* @throws \Mollie\Api\Exceptions\ApiException
*/
public function previous()
Expand Down
3 changes: 2 additions & 1 deletion src/Traits/DelegatesToResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

/**
* @mixin Response
*
* @property null|BaseResource|ResourceCollection $resource
*/
trait DelegatesToResource
Expand Down Expand Up @@ -49,7 +50,7 @@ public function __get($key)
{
$this->ensureResourceIsLoaded();

if (!property_exists($this->resource, $key)) {
if (! property_exists($this->resource, $key)) {
throw new \InvalidArgumentException("Property {$key} does not exist on resource.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function iterator()
{
$client = new MockClient([
GetPaginatedChargebacksRequest::class => new MockResponse(200, 'chargeback-list'),
DynamicGetRequest::class => new MockResponse(200, 'empty-list','chargebacks'),
DynamicGetRequest::class => new MockResponse(200, 'empty-list', 'chargebacks'),
]);

foreach ($client->chargebacks->iterator() as $chargeback) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function iterator_for_id()
{
$client = new MockClient([
GetPaginatedPaymentChargebacksRequest::class => new MockResponse(200, 'chargeback-list'),
DynamicGetRequest::class => new MockResponse(200, 'empty-list','chargebacks'),
DynamicGetRequest::class => new MockResponse(200, 'empty-list', 'chargebacks'),
]);

foreach ($client->paymentChargebacks->iteratorForId('tr_7UhSN1zuXS') as $chargeback) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function iterator_for()
{
$client = new MockClient([
GetPaginatedSettlementChargebacksRequest::class => new MockResponse(200, 'chargeback-list'),
DynamicGetRequest::class => new MockResponse(200, 'empty-list','chargebacks'),
DynamicGetRequest::class => new MockResponse(200, 'empty-list', 'chargebacks'),
]);

$settlement = new Settlement($client);
Expand Down
4 changes: 2 additions & 2 deletions tests/Http/Adapter/MockMollieHttpAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use Mollie\Api\Http\PendingRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Traits\HasDefaultFactories;
use PHPUnit\Framework\Assert as PHPUnit;
use Tests\Fixtures\MockResponse;
use Tests\Fixtures\SequenceMockResponse;
use PHPUnit\Framework\Assert as PHPUnit;

class MockMollieHttpAdapter implements HttpAdapterContract
{
Expand Down Expand Up @@ -78,7 +78,7 @@ private function getResponse(string $requestClass): MockResponse
return $response;
}

public function recorded(callable $callback = null): array
public function recorded(?callable $callback = null): array
{
if ($callback === null) {
return $this->recorded;
Expand Down
9 changes: 6 additions & 3 deletions tests/Http/Requests/DynamicRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ public function it_throws_exception_for_invalid_resource_class()
$this->expectExceptionMessage("The resource class 'NonExistentClass' does not exist.");

/** @phpstan-ignore-next-line */
new class('some-url', 'NonExistentClass') extends DynamicRequest {
new class('some-url', 'NonExistentClass') extends DynamicRequest
{
protected static string $method = Method::GET;
};
}

/** @test */
public function it_accepts_valid_resource_class()
{
$request = new class('some-url', Payment::class) extends DynamicRequest {
$request = new class('some-url', Payment::class) extends DynamicRequest
{
protected static string $method = Method::GET;
};

Expand All @@ -36,7 +38,8 @@ public function it_accepts_valid_resource_class()
public function it_resolves_correct_resource_path()
{
$url = 'https://example.org';
$request = new class($url, Payment::class) extends DynamicRequest {
$request = new class($url, Payment::class) extends DynamicRequest
{
protected static string $method = Method::GET;
};

Expand Down
5 changes: 2 additions & 3 deletions tests/Http/Requests/GetAllMethodsRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tests\Http\Requests;

use Mollie\Api\Http\Query\GetAllMethodsQuery;
use Mollie\Api\Http\Requests\GetAllMethodsRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Resources\MethodCollection;
Expand All @@ -19,7 +18,7 @@ public function it_can_get_all_methods()
GetAllMethodsRequest::class => new MockResponse(200, 'method-list'),
]);

$request = new GetAllMethodsRequest();
$request = new GetAllMethodsRequest;

/** @var Response */
$response = $client->send($request);
Expand All @@ -31,7 +30,7 @@ public function it_can_get_all_methods()
/** @test */
public function it_resolves_correct_resource_path()
{
$request = new GetAllMethodsRequest();
$request = new GetAllMethodsRequest;

$this->assertEquals('methods/all', $request->resolveResourcePath());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tests\Http\Requests;

use Mollie\Api\Http\Query\PaginatedQuery;
use Mollie\Api\Http\Requests\GetAllPaginatedSubscriptionsRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Resources\SubscriptionCollection;
Expand All @@ -19,7 +18,7 @@ public function it_can_get_paginated_subscriptions()
GetAllPaginatedSubscriptionsRequest::class => new MockResponse(200, 'subscription-list'),
]);

$request = new GetAllPaginatedSubscriptionsRequest();
$request = new GetAllPaginatedSubscriptionsRequest;

/** @var Response */
$response = $client->send($request);
Expand All @@ -31,7 +30,7 @@ public function it_can_get_paginated_subscriptions()
/** @test */
public function it_resolves_correct_resource_path()
{
$request = new GetAllPaginatedSubscriptionsRequest();
$request = new GetAllPaginatedSubscriptionsRequest;

$this->assertEquals('subscriptions', $request->resolveResourcePath());
}
Expand Down
1 change: 0 additions & 1 deletion tests/Http/Requests/GetBalanceReportRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Mollie\Api\Http\Query\GetBalanceReportQuery;
use Mollie\Api\Http\Requests\GetBalanceReportRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Resources\Balance;
use Mollie\Api\Resources\BalanceReport;
use Tests\Fixtures\MockClient;
use Tests\Fixtures\MockResponse;
Expand Down
1 change: 0 additions & 1 deletion tests/Http/Requests/GetClientRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tests\Http\Requests;

use Mollie\Api\Http\Query\GetClientQuery;
use Mollie\Api\Http\Requests\GetClientRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Resources\Client;
Expand Down
5 changes: 2 additions & 3 deletions tests/Http/Requests/GetEnabledMethodsRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tests\Http\Requests;

use Mollie\Api\Http\Query\GetEnabledPaymentMethodsQuery;
use Mollie\Api\Http\Requests\GetEnabledMethodsRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Resources\MethodCollection;
Expand All @@ -19,7 +18,7 @@ public function it_can_get_enabled_methods()
GetEnabledMethodsRequest::class => new MockResponse(200, 'method-list'),
]);

$request = new GetEnabledMethodsRequest();
$request = new GetEnabledMethodsRequest;

/** @var Response */
$response = $client->send($request);
Expand All @@ -31,7 +30,7 @@ public function it_can_get_enabled_methods()
/** @test */
public function it_resolves_correct_resource_path()
{
$request = new GetEnabledMethodsRequest();
$request = new GetEnabledMethodsRequest;

$this->assertEquals('methods', $request->resolveResourcePath());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Http/Requests/GetOnboardingRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function it_can_get_onboarding()
GetOnboardingRequest::class => new MockResponse(200, 'onboarding'),
]);

$request = new GetOnboardingRequest();
$request = new GetOnboardingRequest;

/** @var Response */
$response = $client->send($request);
Expand All @@ -30,7 +30,7 @@ public function it_can_get_onboarding()
/** @test */
public function it_resolves_correct_resource_path()
{
$request = new GetOnboardingRequest();
$request = new GetOnboardingRequest;

$this->assertEquals('onboarding/me', $request->resolveResourcePath());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Mollie\Api\Http\Requests\GetOrganizationPartnerStatusRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Resources\Organization;
use Mollie\Api\Resources\Partner;
use Tests\Fixtures\MockClient;
use Tests\Fixtures\MockResponse;
Expand All @@ -19,7 +18,7 @@ public function it_can_get_organization_partner_status()
GetOrganizationPartnerStatusRequest::class => new MockResponse(200, 'partner-status'),
]);

$request = new GetOrganizationPartnerStatusRequest();
$request = new GetOrganizationPartnerStatusRequest;

/** @var Response */
$response = $client->send($request);
Expand All @@ -31,7 +30,7 @@ public function it_can_get_organization_partner_status()
/** @test */
public function it_resolves_correct_resource_path()
{
$request = new GetOrganizationPartnerStatusRequest();
$request = new GetOrganizationPartnerStatusRequest;

$this->assertEquals('organizations/me/partner', $request->resolveResourcePath());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Http/Requests/GetPaginatedBalanceRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function it_can_get_paginated_balances()
GetPaginatedBalanceRequest::class => new MockResponse(200, 'balance-list'),
]);

$request = new GetPaginatedBalanceRequest();
$request = new GetPaginatedBalanceRequest;

/** @var Response */
$response = $client->send($request);
Expand All @@ -30,7 +30,7 @@ public function it_can_get_paginated_balances()
/** @test */
public function it_resolves_correct_resource_path()
{
$request = new GetPaginatedBalanceRequest();
$request = new GetPaginatedBalanceRequest;

$this->assertEquals('balances', $request->resolveResourcePath());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tests\Http\Requests;

use Mollie\Api\Http\Query\PaginatedQuery;
use Mollie\Api\Http\Requests\GetPaginatedBalanceTransactionRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Resources\BalanceTransactionCollection;
Expand Down
5 changes: 2 additions & 3 deletions tests/Http/Requests/GetPaginatedChargebacksRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tests\Http\Requests;

use Mollie\Api\Http\Query\PaginatedQuery;
use Mollie\Api\Http\Requests\GetPaginatedChargebacksRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Resources\ChargebackCollection;
Expand All @@ -19,7 +18,7 @@ public function it_can_get_paginated_chargebacks()
GetPaginatedChargebacksRequest::class => new MockResponse(200, 'chargeback-list'),
]);

$request = new GetPaginatedChargebacksRequest();
$request = new GetPaginatedChargebacksRequest;

/** @var Response */
$response = $client->send($request);
Expand All @@ -31,7 +30,7 @@ public function it_can_get_paginated_chargebacks()
/** @test */
public function it_resolves_correct_resource_path()
{
$request = new GetPaginatedChargebacksRequest();
$request = new GetPaginatedChargebacksRequest;

$this->assertEquals('chargebacks', $request->resolveResourcePath());
}
Expand Down
5 changes: 2 additions & 3 deletions tests/Http/Requests/GetPaginatedClientRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tests\Http\Requests;

use Mollie\Api\Http\Query\PaginatedQuery;
use Mollie\Api\Http\Requests\GetPaginatedClientRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Resources\ClientCollection;
Expand All @@ -19,7 +18,7 @@ public function it_can_get_paginated_clients()
GetPaginatedClientRequest::class => new MockResponse(200, 'client-list'),
]);

$request = new GetPaginatedClientRequest();
$request = new GetPaginatedClientRequest;

/** @var Response */
$response = $client->send($request);
Expand All @@ -31,7 +30,7 @@ public function it_can_get_paginated_clients()
/** @test */
public function it_resolves_correct_resource_path()
{
$request = new GetPaginatedClientRequest();
$request = new GetPaginatedClientRequest;

$this->assertEquals('clients', $request->resolveResourcePath());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tests\Http\Requests;

use Mollie\Api\Http\Query\GetPaginatedCustomerPaymentsQuery;
use Mollie\Api\Http\Requests\GetPaginatedCustomerPaymentsRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Resources\PaymentCollection;
Expand Down
5 changes: 2 additions & 3 deletions tests/Http/Requests/GetPaginatedCustomerRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tests\Http\Requests;

use Mollie\Api\Http\Query\PaginatedQuery;
use Mollie\Api\Http\Requests\GetPaginatedCustomerRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Resources\CustomerCollection;
Expand All @@ -19,7 +18,7 @@ public function it_can_get_paginated_customers()
GetPaginatedCustomerRequest::class => new MockResponse(200, 'customer-list'),
]);

$request = new GetPaginatedCustomerRequest();
$request = new GetPaginatedCustomerRequest;

/** @var Response */
$response = $client->send($request);
Expand All @@ -31,7 +30,7 @@ public function it_can_get_paginated_customers()
/** @test */
public function it_resolves_correct_resource_path()
{
$request = new GetPaginatedCustomerRequest();
$request = new GetPaginatedCustomerRequest;

$this->assertEquals('customers', $request->resolveResourcePath());
}
Expand Down
5 changes: 2 additions & 3 deletions tests/Http/Requests/GetPaginatedInvoiceRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tests\Http\Requests;

use Mollie\Api\Http\Query\PaginatedQuery;
use Mollie\Api\Http\Requests\GetPaginatedInvoiceRequest;
use Mollie\Api\Http\Response;
use Mollie\Api\Resources\InvoiceCollection;
Expand All @@ -19,7 +18,7 @@ public function it_can_get_paginated_invoices()
GetPaginatedInvoiceRequest::class => new MockResponse(200, 'invoice-list'),
]);

$request = new GetPaginatedInvoiceRequest();
$request = new GetPaginatedInvoiceRequest;

/** @var Response */
$response = $client->send($request);
Expand All @@ -31,7 +30,7 @@ public function it_can_get_paginated_invoices()
/** @test */
public function it_resolves_correct_resource_path()
{
$request = new GetPaginatedInvoiceRequest();
$request = new GetPaginatedInvoiceRequest;

$this->assertEquals('invoices', $request->resolveResourcePath());
}
Expand Down
Loading

0 comments on commit 02ca3a2

Please sign in to comment.