Skip to content

Commit

Permalink
Add void return type to all methods
Browse files Browse the repository at this point in the history
  • Loading branch information
pierredup committed Nov 7, 2023
1 parent dd2aa53 commit 8348e00
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 64 deletions.
2 changes: 1 addition & 1 deletion Action/CaptureAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct()
/**
* @param Capture $request
*/
public function execute($request)
public function execute($request): void
{
RequestNotSupportedException::assertSupports($this, $request);

Expand Down
2 changes: 1 addition & 1 deletion Action/CaptureOffsiteAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct()
/**
* @param Capture $request
*/
public function execute($request)
public function execute($request): void
{
RequestNotSupportedException::assertSupports($this, $request);

Expand Down
2 changes: 1 addition & 1 deletion Action/CaptureOffsiteNullAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CaptureOffsiteNullAction implements ActionInterface, GatewayAwareInterface
/**
* @param Capture $request
*/
public function execute($request)
public function execute($request): void
{
RequestNotSupportedException::assertSupports($this, $request);

Expand Down
2 changes: 1 addition & 1 deletion Action/ConvertPaymentAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ConvertPaymentAction implements ActionInterface
/**
* @param Convert $request
*/
public function execute($request)
public function execute($request): void
{
RequestNotSupportedException::assertSupports($this, $request);

Expand Down
2 changes: 1 addition & 1 deletion Action/NotifyAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct()
/**
* @param Notify $request
*/
public function execute($request)
public function execute($request): void
{
RequestNotSupportedException::assertSupports($this, $request);

Expand Down
2 changes: 1 addition & 1 deletion Action/NotifyNullAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class NotifyNullAction implements ActionInterface, GatewayAwareInterface
/**
* @param Notify $request
*/
public function execute($request)
public function execute($request): void
{
RequestNotSupportedException::assertSupports($this, $request);

Expand Down
2 changes: 1 addition & 1 deletion Action/StatusAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class StatusAction implements ActionInterface
/**
* @param GetStatusInterface $request
*/
public function execute($request)
public function execute($request): void
{
RequestNotSupportedException::assertSupports($this, $request);

Expand Down
2 changes: 1 addition & 1 deletion Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ protected function doRequest(array $fields)
return $result;
}

protected function addGlobalParams(array &$params)
protected function addGlobalParams(array &$params): void
{
$params['VERSION'] = self::VERSION;
$params['IDENTIFIER'] = $this->options['identifier'];
Expand Down
2 changes: 1 addition & 1 deletion Be2BillDirectGatewayFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class Be2BillDirectGatewayFactory extends GatewayFactory
{
protected function populateConfig(ArrayObject $config)
protected function populateConfig(ArrayObject $config): void
{
$config->defaults([
'payum.factory_name' => 'be2bill_direct',
Expand Down
2 changes: 1 addition & 1 deletion Be2BillOffsiteGatewayFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class Be2BillOffsiteGatewayFactory extends Be2BillDirectGatewayFactory
{
protected function populateConfig(ArrayObject $config)
protected function populateConfig(ArrayObject $config): void
{
$config->defaults([
'payum.factory_name' => 'be2bill_offsite',
Expand Down
28 changes: 14 additions & 14 deletions Tests/Action/CaptureActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,36 @@ class CaptureActionTest extends GenericActionTest

protected $requestClass = Capture::class;

public function testShouldImplementActionInterface()
public function testShouldImplementActionInterface(): void
{
$rc = new ReflectionClass(CaptureAction::class);

$this->assertTrue($rc->implementsInterface(ActionInterface::class));
}

public function testShouldImplementGatewayAwareInterface()
public function testShouldImplementGatewayAwareInterface(): void
{
$rc = new ReflectionClass(CaptureAction::class);

$this->assertTrue($rc->implementsInterface(GatewayAwareInterface::class));
}

public function testShouldImplementApiAwareInterface()
public function testShouldImplementApiAwareInterface(): void
{
$rc = new ReflectionClass(CaptureAction::class);

$this->assertTrue($rc->implementsInterface(ApiAwareInterface::class));
}

public function testThrowIfUnsupportedApiGiven()
public function testThrowIfUnsupportedApiGiven(): void
{
$this->expectException(UnsupportedApiException::class);
$action = new CaptureAction();

$action->setApi(new stdClass());
}

public function testThrowIfCreditCardNotSetExplicitlyAndObtainRequestNotSupportedOnCapture()
public function testThrowIfCreditCardNotSetExplicitlyAndObtainRequestNotSupportedOnCapture(): void
{
$this->expectException(LogicException::class);
$this->expectExceptionMessage('Credit card details has to be set explicitly or there has to be an action that supports ObtainCreditCard request.');
Expand All @@ -85,7 +85,7 @@ public function testThrowIfCreditCardNotSetExplicitlyAndObtainRequestNotSupporte
$action->execute($request);
}

public function testShouldDoNothingIfExeccodeSet()
public function testShouldDoNothingIfExeccodeSet(): void
{
$gatewayMock = $this->createGatewayMock();
$gatewayMock
Expand All @@ -110,7 +110,7 @@ public function testShouldDoNothingIfExeccodeSet()
$action->execute($request);
}

public function testShouldCaptureWithCreditCardSetExplicitly()
public function testShouldCaptureWithCreditCardSetExplicitly(): void
{
$gatewayMock = $this->createGatewayMock();
$gatewayMock
Expand Down Expand Up @@ -156,14 +156,14 @@ public function testShouldCaptureWithCreditCardSetExplicitly()
$this->assertSame('FOOVAL', $model['FOO']);
}

public function testShouldCaptureWithObtainedCreditCard()
public function testShouldCaptureWithObtainedCreditCard(): void
{
$gatewayMock = $this->createGatewayMock();
$gatewayMock
->expects($this->once())
->method('execute')
->with($this->isInstanceOf(ObtainCreditCard::class))
->willReturnCallback(function (ObtainCreditCard $request) {
->willReturnCallback(function (ObtainCreditCard $request): void {
$card = new CreditCard();
$card->setNumber('1234567812345678');
$card->setExpireAt(new DateTime('2014-10-01'));
Expand Down Expand Up @@ -212,14 +212,14 @@ public function testShouldCaptureWithObtainedCreditCard()
$this->assertNull($model['CARDCODE']->peek(), 'Already erased');
}

public function testShouldCaptureWithObtainedCreditCardWhenTokenReturned()
public function testShouldCaptureWithObtainedCreditCardWhenTokenReturned(): void
{
$gatewayMock = $this->createGatewayMock();
$gatewayMock
->expects($this->once())
->method('execute')
->with($this->isInstanceOf(ObtainCreditCard::class))
->willReturnCallback(function (ObtainCreditCard $request) {
->willReturnCallback(function (ObtainCreditCard $request): void {
$card = new CreditCard();
$card->setToken('theCreditCardToken');

Expand Down Expand Up @@ -264,7 +264,7 @@ public function testShouldCaptureWithObtainedCreditCardWhenTokenReturned()
], $model);
}

public function testShouldPassFirstAndCurrentModelsWithObtainCreditCardSubRequest()
public function testShouldPassFirstAndCurrentModelsWithObtainCreditCardSubRequest(): void
{
$firstModel = new stdClass();
$currentModel = new ArrayObject([
Expand All @@ -288,7 +288,7 @@ public function testShouldPassFirstAndCurrentModelsWithObtainCreditCardSubReques
->expects($this->once())
->method('execute')
->with($this->isInstanceOf(ObtainCreditCard::class))
->willReturnCallback(function (ObtainCreditCard $request) use ($firstModel, $currentModel) {
->willReturnCallback(function (ObtainCreditCard $request) use ($firstModel, $currentModel): void {
$this->assertSame($firstModel, $request->getFirstModel());
$this->assertSame($currentModel, $request->getModel());

Expand All @@ -309,7 +309,7 @@ public function testShouldPassFirstAndCurrentModelsWithObtainCreditCardSubReques
$action->execute($capture);
}

public function testShouldThrowHttpResponseIfExecCode3DSecureRequired()
public function testShouldThrowHttpResponseIfExecCode3DSecureRequired(): void
{
$action = new CaptureAction();

Expand Down
14 changes: 7 additions & 7 deletions Tests/Action/CaptureOffsiteActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,36 @@ class CaptureOffsiteActionTest extends GenericActionTest

protected $requestClass = Capture::class;

public function testShouldImplementActionInterface()
public function testShouldImplementActionInterface(): void
{
$rc = new ReflectionClass(CaptureOffsiteAction::class);

$this->assertTrue($rc->implementsInterface(ActionInterface::class));
}

public function testShouldImplementGatewayAwareInterface()
public function testShouldImplementGatewayAwareInterface(): void
{
$rc = new ReflectionClass(CaptureOffsiteAction::class);

$this->assertTrue($rc->implementsInterface(GatewayAwareInterface::class));
}

public function testShouldImplementApiAwareInterface()
public function testShouldImplementApiAwareInterface(): void
{
$rc = new ReflectionClass(CaptureOffsiteAction::class);

$this->assertTrue($rc->implementsInterface(ApiAwareInterface::class));
}

public function testThrowIfUnsupportedApiGiven()
public function testThrowIfUnsupportedApiGiven(): void
{
$this->expectException(UnsupportedApiException::class);
$action = new CaptureOffsiteAction();

$action->setApi(new stdClass());
}

public function testShouldRedirectToBe2billSiteIfExecCodeNotPresentInQuery()
public function testShouldRedirectToBe2billSiteIfExecCodeNotPresentInQuery(): void
{
$this->expectException(HttpPostRedirect::class);
$model = [
Expand Down Expand Up @@ -91,7 +91,7 @@ public function testShouldRedirectToBe2billSiteIfExecCodeNotPresentInQuery()
$action->execute($request);
}

public function testShouldUpdateModelWhenComeBackFromBe2billSite()
public function testShouldUpdateModelWhenComeBackFromBe2billSite(): void
{
$model = [
'AMOUNT' => 1000,
Expand All @@ -111,7 +111,7 @@ public function testShouldUpdateModelWhenComeBackFromBe2billSite()
->expects($this->once())
->method('execute')
->with($this->isInstanceOf(GetHttpRequest::class))
->willReturnCallback(function (GetHttpRequest $request) {
->willReturnCallback(function (GetHttpRequest $request): void {
$request->query['EXECCODE'] = 1;
$request->query['FOO'] = 'fooVal';
})
Expand Down
4 changes: 2 additions & 2 deletions Tests/Action/ConvertPaymentActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function provideNotSupportedRequests(): Iterator
yield [new $this->requestClass($this->createMock(PaymentInterface::class), 'foobar')];
}

public function testShouldCorrectlyConvertOrderToDetailsAndSetItBack()
public function testShouldCorrectlyConvertOrderToDetailsAndSetItBack(): void
{
$payment = new Payment();
$payment->setNumber('theNumber');
Expand Down Expand Up @@ -70,7 +70,7 @@ public function testShouldCorrectlyConvertOrderToDetailsAndSetItBack()
$this->assertSame('theClientEmail', $details['CLIENTEMAIL']);
}

public function testShouldNotOverwriteAlreadySetExtraDetails()
public function testShouldNotOverwriteAlreadySetExtraDetails(): void
{
$payment = new Payment();
$payment->setCurrencyCode('USD');
Expand Down
18 changes: 9 additions & 9 deletions Tests/Action/NotifyActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,36 @@ class NotifyActionTest extends GenericActionTest

protected $requestClass = Notify::class;

public function testShouldImplementGatewayAwareInterface()
public function testShouldImplementGatewayAwareInterface(): void
{
$rc = new ReflectionClass(NotifyAction::class);

$this->assertTrue($rc->implementsInterface(GatewayAwareInterface::class));
}

public function testShouldImplementApiAwareInterface()
public function testShouldImplementApiAwareInterface(): void
{
$rc = new ReflectionClass(NotifyAction::class);

$this->assertTrue($rc->implementsInterface(ApiAwareInterface::class));
}

public function testThrowIfUnsupportedApiGiven()
public function testThrowIfUnsupportedApiGiven(): void
{
$this->expectException(UnsupportedApiException::class);
$action = new NotifyAction();

$action->setApi(new stdClass());
}

public function testThrowIfQueryHashDoesNotMatchExpected()
public function testThrowIfQueryHashDoesNotMatchExpected(): void
{
$gatewayMock = $this->createGatewayMock();
$gatewayMock
->expects($this->once())
->method('execute')
->with($this->isInstanceOf(GetHttpRequest::class))
->willReturnCallback(function (GetHttpRequest $request) {
->willReturnCallback(function (GetHttpRequest $request): void {
$request->query = ['expected be2bill query'];
})
;
Expand Down Expand Up @@ -80,14 +80,14 @@ public function testThrowIfQueryHashDoesNotMatchExpected()
$this->fail('The exception is expected');
}

public function testThrowIfQueryAmountDoesNotMatchOneFromModel()
public function testThrowIfQueryAmountDoesNotMatchOneFromModel(): void
{
$gatewayMock = $this->createGatewayMock();
$gatewayMock
->expects($this->once())
->method('execute')
->with($this->isInstanceOf(GetHttpRequest::class))
->willReturnCallback(function (GetHttpRequest $request) {
->willReturnCallback(function (GetHttpRequest $request): void {
$request->query = [
'AMOUNT' => 2.0,
];
Expand Down Expand Up @@ -119,14 +119,14 @@ public function testThrowIfQueryAmountDoesNotMatchOneFromModel()
$this->fail('The exception is expected');
}

public function testShouldUpdateModelIfNotificationValid()
public function testShouldUpdateModelIfNotificationValid(): void
{
$gatewayMock = $this->createGatewayMock();
$gatewayMock
->expects($this->once())
->method('execute')
->with($this->isInstanceOf(GetHttpRequest::class))
->willReturnCallback(function (GetHttpRequest $request) {
->willReturnCallback(function (GetHttpRequest $request): void {
$request->query = [
'AMOUNT' => 1.0,
'FOO' => 'FOO',
Expand Down
Loading

0 comments on commit 8348e00

Please sign in to comment.