Skip to content

Commit

Permalink
Merge pull request #33 from sprain/php-7.4
Browse files Browse the repository at this point in the history
Add support for PHP 7.4
  • Loading branch information
sprain authored Apr 20, 2020
2 parents d7ff873 + e9b7bca commit 82cf907
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ php:
- 7.1
- 7.2
- 7.3
- 7.4

env:
matrix:
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"php": ">=7.1",
"symfony/validator": "^3.4|^4.2",
"symfony/intl": "^3.4|^4.2",
"khanamiryan/qrcode-detector-decoder": "^1.0.3",
"kmukku/php-iso11649": "^1.4",
"endroid/qr-code": "^3.5.3"
},
Expand Down
10 changes: 9 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="vendor/autoload.php" colors="true">
<phpunit
bootstrap = "vendor/autoload.php"
colors = "true"
convertDeprecationsToExceptions = "false"
>
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
</php>

<testsuites>
<testsuite name="Swiss Qr Bill Test Suite">
<directory>tests</directory>
Expand Down
10 changes: 10 additions & 0 deletions src/Constraint/ValidCreditorReferenceValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ public function validate($value, Constraint $constraint)
return;
}

// Catch any invalid characters which are not allowed in ISO11649
// (but may not be caught by the underlying library)
if (!preg_match('/^[\w ]*$/', $value)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ string }}', $value)
->addViolation();

return;
}

$referenceGenerator = new phpIso11649();

if (false === $referenceGenerator->validateRfReference($value)) {
Expand Down
1 change: 1 addition & 0 deletions tests/Constraint/ValidCreditorReferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function getInvalidCreditorReferences()
return [
['RF43 1234 5123 45'],
['RF431234512345'],
['RF431234512345Ä'],
['foo']
];
}
Expand Down

0 comments on commit 82cf907

Please sign in to comment.