Skip to content

Commit

Permalink
[!!!][TASK] Downgrade to PHP5.6
Browse files Browse the repository at this point in the history
This change containts the downgraded source and test
files, produced by rector/rector. This counts for the
camt-lib and the iban lib (included) in the same way.

Used command(s):

```shell
tools/bin/rector process
```
  • Loading branch information
sbuerk committed Apr 26, 2023
1 parent 1505473 commit 65b786b
Show file tree
Hide file tree
Showing 121 changed files with 3,061 additions and 1,089 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ jobs:
matrix:
php-version:
- '5.6'
- '7.2'
- '7.4'

name: PHP ${{ matrix.php-version }}
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
]
},
"require": {
"php": "~5.6 || ~7.4",
"php": "~5.6 || ~7.2 || ~7.4",
"ext-dom": "*",
"ext-libxml": "*",
"ext-simplexml": "*",
Expand All @@ -34,6 +34,6 @@
}
},
"require-dev": {
"phpunit/phpunit": "^5.7.27"
"phpunit/phpunit": "^5.7.19"
}
}
4 changes: 2 additions & 2 deletions iban/Tests/CountryInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class CountryInfoTest extends TestCase
*/
private $countryInfo;

protected function setUp(): void
protected function setUp()
{
$this->countryInfo = new CountryInfo('DE');
}
Expand Down Expand Up @@ -56,6 +56,6 @@ public function testIbanCountryCreation()
*/
private function getData()
{
return include dirname(__DIR__, 1) . '/Resource/iban_registry_202009r88.php';
return include dirname(__DIR__) . '/Resource/iban_registry_202009r88.php';
}
}
25 changes: 17 additions & 8 deletions iban/Tests/IbanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,25 @@ final class IbanTest extends TestCase
{
/**
* @dataProvider ibanProvider
*
* @param string $iban,
* @param string $expectedCountryCode,
* @param string $expectedChecksum,
* @param string $expectedBban,
* @param string $expectedBbanBankIdentifier,
* @param string $expectedFormatElectronic,
* @param string $expectedFormatPrint,
* @param string $expectedFormatAnonymized
*/
public function testIbanCreation(
string $iban,
string $expectedCountryCode,
string $expectedChecksum,
string $expectedBban,
string $expectedBbanBankIdentifier,
string $expectedFormatElectronic,
string $expectedFormatPrint,
string $expectedFormatAnonymized
$iban,
$expectedCountryCode,
$expectedChecksum,
$expectedBban,
$expectedBbanBankIdentifier,
$expectedFormatElectronic,
$expectedFormatPrint,
$expectedFormatAnonymized
) {
$iban = new Iban($iban);

Expand Down
4 changes: 2 additions & 2 deletions iban/Tests/Swift/RegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class RegistryTest extends TestCase
*/
private $registry;

protected function setUp(): void
protected function setUp()
{
$this->registry = new Registry(new PhpRegistryLoader());
}
Expand Down Expand Up @@ -56,6 +56,6 @@ public function testItShouldGiveCorrectValuesForCountryCode()
*/
private function getData()
{
return require dirname(__DIR__, 2) . '/Resource/iban_registry_202009r88.php';
return require dirname(dirname(__DIR__)) . '/Resource/iban_registry_202009r88.php';
}
}
2 changes: 1 addition & 1 deletion iban/Tests/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class ValidatorTest extends TestCase
*/
protected $validator;

protected function setUp(): void
protected function setUp()
{
$this->validator = new Validator([
'violation.unsupported_country' => 'unsupported_country',
Expand Down
24 changes: 12 additions & 12 deletions iban/src/Iban.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
*/
class Iban
{
public const FORMAT_ELECTRONIC = 'electronic';
public const FORMAT_PRINT = 'print';
public const FORMAT_ANONYMIZED = 'anonymized';
const FORMAT_ELECTRONIC = 'electronic';
const FORMAT_PRINT = 'print';
const FORMAT_ANONYMIZED = 'anonymized';

private const COUNTRY_CODE_OFFSET = 0;
private const COUNTRY_CODE_LENGTH = 2;
private const CHECKSUM_OFFSET = 2;
private const CHECKSUM_LENGTH = 2;
private const BBAN_OFFSET = 4;
const COUNTRY_CODE_OFFSET = 0;
const COUNTRY_CODE_LENGTH = 2;
const CHECKSUM_OFFSET = 2;
const CHECKSUM_LENGTH = 2;
const BBAN_OFFSET = 4;

/**
* @var string
Expand Down Expand Up @@ -98,7 +98,7 @@ public function getCountryCode()
return substr($this->getNormalizedIban(), self::COUNTRY_CODE_OFFSET, self::COUNTRY_CODE_LENGTH);
}

public function countryCode(): string
public function countryCode()
{
return substr($this->getNormalizedIban(), self::COUNTRY_CODE_OFFSET, self::COUNTRY_CODE_LENGTH);
}
Expand All @@ -114,7 +114,7 @@ public function getChecksum()
return substr($this->getNormalizedIban(), self::CHECKSUM_OFFSET, self::CHECKSUM_LENGTH);
}

public function checksum(): string
public function checksum()
{
return substr($this->getNormalizedIban(), self::CHECKSUM_OFFSET, self::CHECKSUM_LENGTH);
}
Expand All @@ -130,7 +130,7 @@ public function getBban()
return substr($this->getNormalizedIban(), self::BBAN_OFFSET);
}

public function bban(): string
public function bban()
{
return substr($this->getNormalizedIban(), self::BBAN_OFFSET);
}
Expand All @@ -152,7 +152,7 @@ public function getBbanBankIdentifier()
);
}

public function bbanBankIdentifier(): string
public function bbanBankIdentifier()
{
$registry = new Registry(new PhpRegistryLoader());

Expand Down
4 changes: 2 additions & 2 deletions iban/src/Swift/PhpRegistryLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
final class PhpRegistryLoader implements RegistryLoaderInterface
{
public function load(): array
public function load()
{
return require dirname(__DIR__, 2) . '/Resource/iban_registry_202009r88.php';
return require dirname(dirname(__DIR__)) . '/Resource/iban_registry_202009r88.php';
}
}
2 changes: 1 addition & 1 deletion iban/src/Swift/RegistryLoaderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
*/
interface RegistryLoaderInterface
{
public function load(): array;
public function load();
}
2 changes: 0 additions & 2 deletions src/Camt052/DTO/Report.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

namespace Genkgo\Camt\Camt052\DTO;

use Genkgo\Camt\DTO\RecordWithBalances;
Expand Down
6 changes: 3 additions & 3 deletions src/Camt052/Decoder/EntryTransactionDetail.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

namespace Genkgo\Camt\Camt052\Decoder;

use Genkgo\Camt\Decoder\EntryTransactionDetail as BaseDecoder;
Expand All @@ -13,8 +11,10 @@ class EntryTransactionDetail extends BaseDecoder
{
/**
* @inheritDoc
* @param \SimpleXMLElement|null $xmlRelatedPartyTypeAccount
* @return \Genkgo\Camt\DTO\Account|null
*/
public function getRelatedPartyAccount(?SimpleXMLElement $xmlRelatedPartyTypeAccount): ?DTO\Account
public function getRelatedPartyAccount($xmlRelatedPartyTypeAccount)
{
if (!$xmlRelatedPartyTypeAccount) {
return null;
Expand Down
15 changes: 11 additions & 4 deletions src/Camt052/Decoder/Message.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

namespace Genkgo\Camt\Camt052\Decoder;

use Genkgo\Camt\Camt052\DTO as Camt052DTO;
Expand All @@ -14,7 +12,12 @@

abstract class Message extends BaseMessageDecoder
{
public function addRecords(DTO\Message $message, SimpleXMLElement $document): void
/**
* @param \Genkgo\Camt\DTO\Message $message
* @param \SimpleXMLElement $document
* @return void
*/
public function addRecords($message, $document)
{
$reports = [];

Expand Down Expand Up @@ -47,7 +50,11 @@ public function addRecords(DTO\Message $message, SimpleXMLElement $document): vo
$message->setRecords($reports);
}

protected function getAccount(SimpleXMLElement $xmlRecord): Account
/**
* @param \SimpleXMLElement $xmlRecord
* @return \Genkgo\Camt\DTO\Account
*/
protected function getAccount($xmlRecord)
{
if (isset($xmlRecord->Acct->Id->IBAN)) {
return new DTO\IbanAccount(new Iban((string) $xmlRecord->Acct->Id->IBAN));
Expand Down
6 changes: 3 additions & 3 deletions src/Camt052/Decoder/V01/Message.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

namespace Genkgo\Camt\Camt052\Decoder\V01;

use Genkgo\Camt\Camt052\Decoder\Message as BaseMessageDecoder;
Expand All @@ -11,8 +9,10 @@ class Message extends BaseMessageDecoder
{
/**
* @inheritDoc
* @param \SimpleXMLElement $document
* @return \SimpleXMLElement
*/
public function getRootElement(SimpleXMLElement $document): SimpleXMLElement
public function getRootElement($document)
{
return $document->BkToCstmrAcctRptV01;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Camt052/Decoder/V02/Message.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

namespace Genkgo\Camt\Camt052\Decoder\V02;

use Genkgo\Camt\Camt052\Decoder\Message as BaseMessageDecoder;
Expand All @@ -11,8 +9,10 @@ class Message extends BaseMessageDecoder
{
/**
* @inheritDoc
* @param \SimpleXMLElement $document
* @return \SimpleXMLElement
*/
public function getRootElement(SimpleXMLElement $document): SimpleXMLElement
public function getRootElement($document)
{
return $document->BkToCstmrAcctRpt;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Camt052/Decoder/V04/Message.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

namespace Genkgo\Camt\Camt052\Decoder\V04;

use Genkgo\Camt\Camt052\Decoder\Message as BaseMessageDecoder;
Expand All @@ -11,8 +9,10 @@ class Message extends BaseMessageDecoder
{
/**
* @inheritDoc
* @param \SimpleXMLElement $document
* @return \SimpleXMLElement
*/
public function getRootElement(SimpleXMLElement $document): SimpleXMLElement
public function getRootElement($document)
{
return $document->BkToCstmrAcctRpt;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Camt052/Decoder/V06/Message.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

namespace Genkgo\Camt\Camt052\Decoder\V06;

use Genkgo\Camt\Camt052\Decoder\Message as BaseMessageDecoder;
Expand All @@ -11,8 +9,10 @@ class Message extends BaseMessageDecoder
{
/**
* @inheritDoc
* @param \SimpleXMLElement $document
* @return \SimpleXMLElement
*/
public function getRootElement(SimpleXMLElement $document): SimpleXMLElement
public function getRootElement($document)
{
return $document->BkToCstmrAcctRpt;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Camt052/Decoder/V08/Message.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

namespace Genkgo\Camt\Camt052\Decoder\V08;

use Genkgo\Camt\Camt052\Decoder\Message as BaseMessageDecoder;
Expand All @@ -11,8 +9,10 @@ class Message extends BaseMessageDecoder
{
/**
* @inheritDoc
* @param \SimpleXMLElement $document
* @return \SimpleXMLElement
*/
public function getRootElement(SimpleXMLElement $document): SimpleXMLElement
public function getRootElement($document)
{
return $document->BkToCstmrAcctRpt;
}
Expand Down
22 changes: 16 additions & 6 deletions src/Camt052/MessageFormat/V01.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

namespace Genkgo\Camt\Camt052\MessageFormat;

use Genkgo\Camt\Camt052;
Expand All @@ -11,22 +9,34 @@

final class V01 implements MessageFormatInterface
{
public function getXmlNs(): string
/**
* @return string
*/
public function getXmlNs()
{
return 'urn:iso:std:iso:20022:tech:xsd:camt.052.001.01';
}

public function getMsgId(): string
/**
* @return string
*/
public function getMsgId()
{
return 'camt.052.001.01';
}

public function getName(): string
/**
* @return string
*/
public function getName()
{
return 'BankToCustomerAccountReportV01';
}

public function getDecoder(): DecoderInterface
/**
* @return \Genkgo\Camt\DecoderInterface
*/
public function getDecoder()
{
$entryTransactionDetailDecoder = new Camt052\Decoder\EntryTransactionDetail(new Decoder\Date());
$entryDecoder = new Decoder\Entry($entryTransactionDetailDecoder);
Expand Down
Loading

0 comments on commit 65b786b

Please sign in to comment.