Skip to content

Commit 8fa812e

Browse files
committed
Upgrade to php8
This updates the php version and fixes regexes that became incompatible.
1 parent 2ec2465 commit 8fa812e

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"license": "GPL-2.0-or-later",
44
"description": "General and shared validation services created as part of the WMDE fundraising software",
55
"require": {
6-
"php": ">=7.2"
6+
"php": ">=8.0"
77
},
88
"require-dev": {
99
"phpunit/phpunit": "~9.5.1",

composer.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.4'
22

33
services:
44
fun-validators:
5-
image: wikimediade/fundraising-frontend:dev
5+
image: "registry.gitlab.com/fun-tech/fundraising-frontend-docker:latest"
66
volumes:
77
- ./:/usr/src/app
88
working_dir: /usr/src/app

src/Validators/TextPolicyValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private function hasDeniedWordNotMatchingAllowedWords( array $deniedMatches, arr
124124
$deniedMatches,
125125
$allowedMatches,
126126
function ( $deniedMatch, $allowedMatch ) {
127-
return !preg_match( $this->composeRegex( [ $deniedMatch ] ), $allowedMatch );
127+
return (int)!preg_match( $this->composeRegex( [ $deniedMatch ] ), $allowedMatch );
128128
}
129129
)
130130
) > 0;

tests/Unit/Validators/AddressValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class AddressValidatorTest extends TestCase {
2323
];
2424

2525
private const ADDRESS_PATTERNS = [
26-
'firstName' => "/^[A-Za-z\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff\\s\\-\\.\\']+$/",
27-
'lastName' => "/^[A-Za-z\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff\\s\\-\\.\\']+$/",
26+
'firstName' => "/^[A-Za-z\x{00C0}-\x{00D6}\x{00D8}-\x{00f6}\x{00f8}-\x{00ff}\\s\\-\\.\\']+$/",
27+
'lastName' => "/^[A-Za-z\x{00C0}-\x{00D6}\x{00D8}-\x{00f6}\x{00f8}-\x{00ff}\\s\\-\\.\\']+$/",
2828
'postcode' => '/^.+$/',
2929
];
3030

0 commit comments

Comments
 (0)