Skip to content

Commit f09a0d9

Browse files
authored
Merge pull request #265 from sprain/drop-php-80
Drop support for PHP 8.0 | Add support for PHP 8.4
2 parents a28e081 + 107f5de commit f09a0d9

29 files changed

+199
-243
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010

1111
strategy:
1212
matrix:
13-
php: ['8.0', '8.1', '8.2', '8.3']
13+
php: ['8.1', '8.2', '8.3', '8.4']
1414
stability: ['prefer-lowest', 'prefer-stable']
1515

1616
name: PHP Tests ${{ matrix.php }} - ${{ matrix.stability }}
@@ -58,7 +58,7 @@ jobs:
5858
- name: Setup PHP
5959
uses: shivammathur/setup-php@v2
6060
with:
61-
php-version: '8.2'
61+
php-version: '8.3'
6262
extensions: dom, curl, libxml, mbstring, zip, bcmath, gd
6363
tools: composer
6464
coverage: none

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ The beauty of open source software lies in the fact that everybody can benefit f
6262

6363
In addition, a minor version will always be published if any visible change in the output of the qr code or the payment part takes place, even if it could be considered to be just a bugfix.
6464

65+
### PHP version support
66+
67+
This library supports a PHP version as long as it accounts for at least approximately 10% [of current installations](https://packagist.org/packages/sprain/swiss-qr-bill/php-stats).
68+
69+
### Depdendency support
70+
71+
Older versions of dependencies are supported as long as they do not hinder further development or account for at least
72+
approximately 10% of current installations of the corresponding dependency.
73+
6574
## Support the project
6675

6776
* Do you like this project? [Consider a Github sponsorship.](https://github.com/sponsors/sprain)

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "library",
55
"license": "MIT",
66
"require": {
7-
"php": "~8.0.0|~8.1.0|~8.2.0|~8.3.0",
7+
"php": "~8.1.0|~8.2.0|~8.3.0|~8.4.0",
88
"ext-dom": "*",
99
"ext-bcmath": "*",
1010
"symfony/validator": "^4.4|^5.0|^6.0|^7.0",
@@ -24,7 +24,8 @@
2424
"phpstan/phpstan": "^1.11-dev",
2525
"setasign/fpdi": "^2.3.5",
2626
"setasign/fpdf": "^1.8.2",
27-
"tecnickcom/tcpdf": "^6.3.2"
27+
"tecnickcom/tcpdf": "^6.3.2",
28+
"rector/rector": "^1.2"
2829
},
2930
"scripts": {
3031
"cs:fix": "vendor/bin/php-cs-fixer fix --verbose",

example/FpdfOutput/fpdf-example.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php declare(strict_types=1);
22

3+
use Fpdf\Fpdf;
34
use Sprain\SwissQrBill as QrBill;
45
use Sprain\SwissQrBill\PaymentPart\Output\DisplayOptions;
56

@@ -10,7 +11,7 @@
1011

1112
// 2. Create an FPDF instance (or use an existing one from your project)
1213
// – alternatively, an instance of \setasign\Fpdi\Fpdi() is also accepted by FpdfOutput.
13-
$fpdf = new \Fpdf\Fpdf('P', 'mm', 'A4');
14+
$fpdf = new Fpdf('P', 'mm', 'A4');
1415

1516
// In case your server does not support "allow_url_fopen", use this way to create your FPDF instance:
1617
// $fpdf = new class('P', 'mm', 'A4') extends \Fpdf\Fpdf {

example/example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
try {
8484
$qrBill->getQrCode()->writeFile(__DIR__ . '/qr.png');
8585
$qrBill->getQrCode()->writeFile(__DIR__ . '/qr.svg');
86-
} catch (Exception $e) {
86+
} catch (Exception) {
8787
foreach ($qrBill->getViolations() as $violation) {
8888
print $violation->getMessage()."\n";
8989
}

example/example_minimal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
try {
5252
$qrBill->getQrCode()->writeFile(__DIR__ . '/qr.png');
5353
$qrBill->getQrCode()->writeFile(__DIR__ . '/qr.svg');
54-
} catch (Exception $e) {
54+
} catch (Exception) {
5555
foreach ($qrBill->getViolations() as $violation) {
5656
print $violation->getMessage()."\n";
5757
}

example/example_scor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
try {
7474
$qrBill->getQrCode()->writeFile(__DIR__ . '/qr.png');
7575
$qrBill->getQrCode()->writeFile(__DIR__ . '/qr.svg');
76-
} catch (Exception $e) {
76+
} catch (Exception) {
7777
foreach ($qrBill->getViolations() as $violation) {
7878
print $violation->getMessage()."\n";
7979
}

example/example_zero_amount.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
try {
6363
$qrBill->getQrCode()->writeFile(__DIR__ . '/qr.png');
6464
$qrBill->getQrCode()->writeFile(__DIR__ . '/qr.svg');
65-
} catch (Exception $e) {
65+
} catch (Exception) {
6666
foreach ($qrBill->getViolations() as $violation) {
6767
print $violation->getMessage()."\n";
6868
}

rector.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
7+
use Rector\Set\ValueObject\SetList;
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->paths([
11+
__DIR__ . '/example',
12+
__DIR__ . '/src',
13+
__DIR__ . '/tests',
14+
]);
15+
16+
$rectorConfig->importNames(true);
17+
$rectorConfig->importShortClasses(false)
18+
19+
$rectorConfig->sets([SetList::PHP_81]);
20+
21+
$rectorConfig->rule(ClassPropertyAssignToConstructorPromotionRector::class);
22+
};

src/DataGroup/Element/AdditionalInformation.php

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,18 @@ final class AdditionalInformation implements QrCodeableInterface, SelfValidatabl
1414

1515
public const TRAILER_EPD = 'EPD';
1616

17-
/**
18-
* Unstructured information can be used to indicate the payment purpose
19-
* or for additional textual information about payments with a structured reference.
20-
*/
21-
private ?string $message;
22-
23-
/**
24-
* Bill information contains coded information for automated booking of the payment.
25-
* The data is not forwarded with the payment.
26-
*/
27-
private ?string $billInformation;
28-
2917
private function __construct(
30-
?string $message,
31-
?string $billInformation
18+
/**
19+
* Unstructured information can be used to indicate the payment purpose
20+
* or for additional textual information about payments with a structured reference.
21+
*/
22+
private ?string $message,
23+
/**
24+
* Bill information contains coded information for automated booking of the payment.
25+
* The data is not forwarded with the payment.
26+
*/
27+
private ?string $billInformation
3228
) {
33-
$this->message = $message;
34-
$this->billInformation = $billInformation;
3529
}
3630

3731
public static function create(

0 commit comments

Comments
 (0)