Skip to content

Commit 0227c80

Browse files
authored
Merge pull request #16 from bmiddendorp/master
Remove safe dependency
2 parents d88319f + ed0d689 commit 0227c80

5 files changed

Lines changed: 11 additions & 8 deletions

File tree

composer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
"require": {
2727
"php": "^7.2|^8.0",
2828
"symfony/validator": "^3.4|^4.3|^5.0",
29-
"aeviiq/enum": "^2.0 || ^3.0",
30-
"thecodingmachine/safe": "^1.3"
29+
"aeviiq/enum": "^2.0 || ^3.0"
3130
},
3231
"require-dev": {
3332
"phpstan/phpstan": "^0.12.59",
@@ -36,7 +35,6 @@
3635
"phpunit/phpunit": "^8.5",
3736
"psalm/plugin-phpunit": "^0.16.1",
3837
"roave/security-advisories": "dev-master",
39-
"thecodingmachine/phpstan-safe-rule": "^1.0",
4038
"thecodingmachine/phpstan-strict-rules": "^0.12.1",
4139
"vimeo/psalm": "^4.11"
4240
},

phpstan.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ parameters:
66
includes:
77
- vendor/phpstan/phpstan-strict-rules/rules.neon
88
- vendor/phpstan/phpstan-phpunit/extension.neon
9-
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
109
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon

src/Constraint/Bsn.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@ final class Bsn extends Constraint
1010
* @var string
1111
*/
1212
public $message = 'This is not a valid BSN.';
13+
14+
/**
15+
* @var string[]
16+
*/
17+
public $groups = [self::DEFAULT_GROUP];
1318
}

src/Normalizer.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22

33
namespace Aeviiq\ValueObject;
44

5-
use function Safe\preg_replace;
5+
use UnexpectedValueException;
66

77
final class Normalizer
88
{
99
public static function removeWhitespace(string $value): string
1010
{
11-
/** @var string $replaced */
1211
$replaced = preg_replace('/\s+/', '', $value);
1312

13+
if(!is_string($replaced)) {
14+
throw new UnexpectedValueException(sprintf('Could not remove whitespaces from string "%s".', $value));
15+
}
16+
1417
return $replaced;
1518
}
1619
}

src/Validator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
use Symfony\Component\Validator\Validation;
1010
use Symfony\Component\Validator\Validator\ValidatorInterface;
1111

12-
use function Safe\sprintf;
13-
1412
final class Validator
1513
{
1614
/**

0 commit comments

Comments
 (0)