Skip to content

Commit 37fcde0

Browse files
authored
Merge pull request #10 from peter279k/upgrade_phpstan_phpcs_fixer
Upgrade PHPStan and PHP-CS-Fixer
2 parents fa74666 + 5720f01 commit 37fcde0

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
"require-dev": {
2020
"cakephp/validation": "^4.2",
2121
"fig/http-message-util": "^1.1",
22-
"friendsofphp/php-cs-fixer": "^2.16",
22+
"friendsofphp/php-cs-fixer": "^3",
2323
"nyholm/psr7": "^1.4",
2424
"overtrue/phplint": "^1.1",
25-
"phpstan/phpstan": "^0.12",
25+
"phpstan/phpstan": "^1",
2626
"phpunit/phpunit": "^8 || ^9",
2727
"relay/relay": "^2.0",
2828
"slim/psr7": "^1",
@@ -43,7 +43,7 @@
4343
},
4444
"minimum-stability": "stable",
4545
"scripts": {
46-
"cs:check": "php-cs-fixer fix --dry-run --format=txt --verbose --diff --diff-format=udiff --config=.cs.php",
46+
"cs:check": "php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php",
4747
"cs:fix": "php-cs-fixer fix --config=.cs.php",
4848
"lint": "phplint ./ --exclude=vendor --no-interaction --no-cache",
4949
"phpstan": "phpstan analyse src --level=max -c phpstan.neon --no-progress --ansi",

phpstan.neon

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
parameters:
2+
level: max
23
reportUnmatchedIgnoredErrors: false
34
checkMissingIterableValueType: false
4-
checkGenericClassInNonGenericObjectType: false
5+
checkGenericClassInNonGenericObjectType: false
6+
paths:
7+
- src
8+
- tests
9+
ignoreErrors:
10+
- '#Cannot cast mixed to int.#'

src/Regex/ValidationRegex.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,50 @@ final class ValidationRegex
1010
/**
1111
* ISO date time format: Y-m-d H:i:s.
1212
*/
13-
const DATE_TIME_ISO = '/^[\d]{4}\-[\d]{2}\-[\d]{2} [\d]{2}\:[\d]{2}\:[\d]{2}$/';
13+
public const DATE_TIME_ISO = '/^[\d]{4}\-[\d]{2}\-[\d]{2} [\d]{2}\:[\d]{2}\:[\d]{2}$/';
1414

1515
/**
1616
* ISO date time format: Y-m-d.
1717
*/
18-
const DATE_ISO = '/^[\d]{4}\-[\d]{2}\-[\d]{2}$/';
18+
public const DATE_ISO = '/^[\d]{4}\-[\d]{2}\-[\d]{2}$/';
1919

2020
/**
2121
* Date format: d.m.Y.
2222
*/
23-
const DATE_DMY = '/^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$/';
23+
public const DATE_DMY = '/^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$/';
2424

2525
/**
2626
* International phone number.
2727
*/
28-
const PHONE_NUMBER = '/^\+[0-9]{6,}$/';
28+
public const PHONE_NUMBER = '/^\+[0-9]{6,}$/';
2929

3030
/**
3131
* ISO 2 country code, e.g. CH, DE, FR.
3232
*/
33-
const COUNTRY_ISO_2 = '/^[A-Z]{2}$/';
33+
public const COUNTRY_ISO_2 = '/^[A-Z]{2}$/';
3434

3535
/**
3636
* String with no spaces at both ends.
3737
*/
38-
const TRIMMED = '/^[\S]+(?: +[\S]+)*$/';
38+
public const TRIMMED = '/^[\S]+(?: +[\S]+)*$/';
3939

4040
/**
4141
* Positive integer >= 1.
4242
*/
43-
const ID = '/^[1-9][0-9]*$/';
43+
public const ID = '/^[1-9][0-9]*$/';
4444

4545
/**
4646
* Generic UUID.
4747
*/
48-
const UUID = '/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/';
48+
public const UUID = '/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/';
4949

5050
/**
5151
* Postal code. Can start with 0. Not for canada.
5252
*/
53-
const POSTAL_CODE = '/^[\d]{4,}$/';
53+
public const POSTAL_CODE = '/^[\d]{4,}$/';
5454

5555
/**
5656
* Positive float.
5757
*/
58-
const POSITIVE_FLOAT = '/^([\d]*[.])?[\d]+$/';
58+
public const POSITIVE_FLOAT = '/^([\d]*[.])?[\d]+$/';
5959
}

0 commit comments

Comments
 (0)