Skip to content

Commit

Permalink
added some returntypes, and fixes for php 7.4 and higher (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
twitnic committed Feb 6, 2023
1 parent fba9605 commit 482bccc
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 102 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: ['ubuntu-18.04']
php-versions: ['7.2', '7.3', '7.4', '8.0']
operating-system: ['ubuntu-22.04']
php-versions: ['7.4', '8.0']

steps:
- uses: actions/checkout@v1
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"name": "Sander Marechal",
"email": "s.marechal@jejik.com",
"homepage": "http://www.jejik.com"
"homepage": "https://www.jejik.com"
},
{
"name": "powercloud GmbH / Dominic Richter",
Expand All @@ -17,10 +17,10 @@
}
],
"require": {
"php": ">=7.2.0||^8.0"
"php": ">=7.4.0||^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8",
"phpunit/phpunit": "^9",
"squizlabs/php_codesniffer": "3.*"
},
"autoload": {
Expand Down
23 changes: 10 additions & 13 deletions lib/Jejik/MT940/Parser/AbstractParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ protected function splitTransactions(string $text): array
*
* @throws \Exception
*/
protected function statement(string $text): ?Statement
protected function statement(string $text): ?StatementInterface
{
$text = trim($text);
if (($pos = strpos($text, ':20:')) === false) {
Expand Down Expand Up @@ -272,7 +272,7 @@ protected function statementHeader(string $text): void
*
* @throws \Exception
*/
protected function statementBody(string $text): ?Statement
protected function statementBody(string $text): ?StatementInterface
{
$accountNumber = $this->accountNumber($text);
$accountCurrency = $this->accountCurrency($text);
Expand Down Expand Up @@ -351,10 +351,7 @@ protected function accountCurrency($text): ?string
if ($line60F = $this->getLine('60F', $text)) {
$pcreCurrency = '/(C|D)(\d{6})([A-Z]{3})([0-9,]{1,15})/';
preg_match($pcreCurrency, $text, $match);
if (isset($match[3])) {
return $match[3];
}
return null;
return $match[3] ?? null;
}
}
return $currency;
Expand Down Expand Up @@ -468,7 +465,7 @@ protected function transaction(array $lines): TransactionInterface
$bookDate = $bookDateCollection[min(array_keys($bookDateCollection))];
}

$description = isset($lines[1]) ? $lines[1] : null;
$description = $lines[1] ?? null;
$transaction = $this->reader->createTransaction();
$transaction
->setAmount($amount)
Expand Down Expand Up @@ -691,47 +688,47 @@ protected function svwz(array $lines): ?string
{
return null;
}

/**
* Parse purp for provided transaction lines
*/
protected function purp(array $lines): ?string
{
return null;
}

/**
* Parse debt for provided transaction lines
*/
protected function debt(array $lines): ?string
{
return null;
}

/**
* Parse coam for provided transaction lines
*/
protected function coam(array $lines): ?string
{
return null;
}

/**
* Parse oamt for provided transaction lines
*/
protected function oamt(array $lines): ?string
{
return null;
}

/**
* Parse abwa for provided transaction lines
*/
protected function abwa(array $lines): ?string
{
return null;
}

/**
* Parse abwe for provided transaction lines
*/
Expand Down
Loading

0 comments on commit 482bccc

Please sign in to comment.