Skip to content

Commit ba536ce

Browse files
authored
Merge pull request #17 from kiczort/symfony_6.1
Symfony 6.1 support
2 parents 97c88b6 + 5bdd646 commit ba536ce

File tree

21 files changed

+105
-109
lines changed

21 files changed

+105
-109
lines changed

.docker/php/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM php:cli-alpine as php-base
2+
3+
# Install composer
4+
ENV COMPOSER_ALLOW_SUPERUSER 1
5+
ENV COMPOSER_HOME /var/www/.composer
6+
7+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
8+
9+
RUN apk add --update icu && \
10+
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS icu-dev && \
11+
docker-php-ext-configure intl && \
12+
docker-php-ext-install intl && \
13+
apk del .build-deps && \
14+
rm -Rf /tmp/*

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.docker export-ignore
2+
/.gitattributes export-ignore
3+
/.github export-ignore
4+
/.gitignore export-ignore
5+
/docker-compose.yaml export-ignore
6+
/README.md export-ignore
7+
/phpunit.xml.dist export-ignore
8+
/tests export-ignore

.github/workflows/test.yaml

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,23 @@ jobs:
66
test:
77
name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }}
88

9-
runs-on: ubuntu-18.04
9+
runs-on: ubuntu-20.04
1010

1111
continue-on-error: ${{ matrix.experimental }}
1212

1313
strategy:
1414
matrix:
1515
include:
16-
- php-version: '7.1'
17-
symfony-version: '^4.4'
18-
composer-version: v1
19-
stability: stable
20-
coverage: none
21-
experimental: false
22-
- php-version: '7.2'
23-
symfony-version: '^4.4'
24-
composer-version: v1
25-
stability: stable
26-
coverage: none
27-
experimental: false
28-
- php-version: '7.2'
29-
symfony-version: '^5.0'
30-
composer-version: v1
31-
stability: stable
32-
coverage: none
33-
experimental: false
34-
- php-version: '7.3'
35-
symfony-version: '^5.0'
36-
composer-version: v1
37-
stability: stable
38-
coverage: none
39-
experimental: false
40-
- php-version: '7.4'
41-
symfony-version: '^5.0'
16+
- php-version: '8.1'
17+
symfony-version: '^6.0'
4218
composer-version: v2
4319
stability: stable
44-
coverage: xdebug
45-
experimental: false
46-
- php-version: '8.0'
47-
symfony-version: '^5.0'
48-
composer-version: v2
49-
stability: RC
5020
coverage: none
5121
experimental: false
52-
- php-version: '8.1'
53-
symfony-version: '^5.0'
22+
- php-version: '8.2'
23+
symfony-version: '^6.1'
5424
composer-version: v2
5525
stability: RC
56-
coverage: none
5726
experimental: false
5827

5928
steps:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ vendor/
33
bin/
44
.idea
55
.phpunit.result.cache
6-
6+
composer.lock

.travis.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class Person
6363
* strict = true
6464
* )
6565
*/
66+
#[KiczortAssert\Pesel(message: "The '{{ value }}' is not a valid PESEL number.", strict: true)]
6667
protected $pesel;
6768
}
6869
```
@@ -81,6 +82,7 @@ class Person
8182
/**
8283
* @KiczortAssert\Nip
8384
*/
85+
#[KiczortAssert\Nip(message: "This is not a valid NIP number.")]
8486
protected $nip;
8587
}
8688
```
@@ -99,6 +101,7 @@ class Company
99101
/**
100102
* @KiczortAssert\Regon
101103
*/
104+
#[KiczortAssert\Regon(message: "This is not a valid REGON number.")]
102105
protected $regon;
103106
}
104107
```
@@ -122,6 +125,7 @@ class Doctor
122125
/**
123126
* @KiczortAssert\Pwz
124127
*/
128+
#[KiczortAssert\Pwz(message: "This is not a valid PWZ number.")]
125129
protected $pwz;
126130
}
127131
```
@@ -138,4 +142,4 @@ License can be found [here](https://github.com/kiczort/polish-validator-bundle/b
138142

139143

140144

141-
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fkiczort%2Fpolish-validator-bundle.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkiczort%2Fpolish-validator-bundle?ref=badge_large)
145+
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fkiczort%2Fpolish-validator-bundle.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkiczort%2Fpolish-validator-bundle?ref=badge_large)

composer.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,23 @@
1010
}
1111
],
1212
"require": {
13-
"php": ">=7.1.3",
13+
"php": ">=8.0",
14+
"ext-intl": "*",
1415
"kiczort/polish-validator": "^1.1",
15-
"symfony/config" : "~4.4 || ~5.0 || ~6.0",
16-
"symfony/http-kernel" : "~4.4 || ~5.0 || ~6.0",
17-
"symfony/dependency-injection" : "~4.4 || ~5.0 || ~6.0",
18-
"symfony/validator": "~4.4 || ~5.0 || ~6.0"
16+
"symfony/config" : "~6.1",
17+
"symfony/http-kernel" : "~6.1",
18+
"symfony/dependency-injection" : "~6.1",
19+
"symfony/validator": "~6.1"
1920
},
2021
"require-dev": {
21-
"phpunit/phpunit": "~7.0 || ~8.0 || ~9.0",
22-
"symfony/phpunit-bridge": "~4.4 || ~5.0 || ~6.0"
22+
"roave/security-advisories": "dev-latest",
23+
"phpunit/phpunit": "~9.0",
24+
"symfony/phpunit-bridge": "~6.1",
25+
"symfony/intl": "^6.2"
2326
},
2427
"autoload": {
25-
"psr-0": {
26-
"": "src/"
28+
"psr-4": {
29+
"Kiczort\\": "src/Kiczort/"
2730
}
2831
},
2932
"config": {

docker-compose.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
services:
2+
php:
3+
build:
4+
dockerfile: .docker/php/Dockerfile
5+
context: .
6+
environment:
7+
COMPOSER_HOME: /.composer
8+
volumes:
9+
- .:/app
10+
- ~/.composer:/.composer
11+
user: 1000:1000
12+
working_dir: /app
13+
command: tail -f /dev/null

phpunit.xml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
4-
<phpunit
5-
backupGlobals = "false"
6-
backupStaticAttributes = "false"
7-
colors = "true"
8-
convertErrorsToExceptions = "true"
9-
convertNoticesToExceptions = "true"
10-
convertWarningsToExceptions = "true"
11-
processIsolation = "false"
12-
stopOnFailure = "false"
13-
bootstrap = "vendor/autoload.php" >
14-
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
cacheResultFile=".phpunit.cache/test-results"
6+
executionOrder="depends,defects"
7+
forceCoversAnnotation="false"
8+
beStrictAboutCoversAnnotation="false"
9+
beStrictAboutOutputDuringTests="true"
10+
beStrictAboutTodoAnnotatedTests="true"
11+
convertDeprecationsToExceptions="true"
12+
failOnRisky="true"
13+
failOnWarning="true"
14+
verbose="true">
1515
<testsuites>
1616
<testsuite name="Project Test Suite">
17-
<directory>src/Kiczort/*/Tests</directory>
17+
<directory>tests</directory>
1818
</testsuite>
1919
</testsuites>
20+
21+
<coverage cacheDirectory=".phpunit.cache/code-coverage"
22+
processUncoveredFiles="true">
23+
<include>
24+
<directory suffix=".php">src</directory>
25+
</include>
26+
</coverage>
2027
</phpunit>

src/Kiczort/PolishValidatorBundle/Validator/Constraints/Nip.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@
1212
namespace Kiczort\PolishValidatorBundle\Validator\Constraints;
1313

1414
use Symfony\Component\Validator\Constraint;
15+
use Symfony\Component\Validator\Attribute\HasNamedArguments;
1516

1617
/**
1718
* @author Grzegorz Koziński <gkozinski@gmail.com>
1819
*
1920
* @Annotation
2021
*/
22+
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
2123
class Nip extends Constraint
2224
{
23-
public $message = 'This is not a valid NIP number.';
24-
25+
public string $message = 'This is not a valid NIP number.';
2526
/**
2627
* {@inheritdoc}
2728
*/
2829
public function validatedBy(): string
2930
{
30-
return 'kiczort.validator.nip';
31+
return static::class.'Validator';
3132
}
3233
}

0 commit comments

Comments
 (0)