Skip to content

Commit 1400e5b

Browse files
authored
refactor: remove thecodingmachine/safe dependency (#440)
1 parent d3da820 commit 1400e5b

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

composer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"php": ">=8.1",
2424
"illuminate/support": "^9.0 || ^10.0",
2525
"psr/http-factory-implementation": "1.0",
26-
"thecodingmachine/safe": "^2.0",
2726
"web-auth/cose-lib": "^4.0",
2827
"web-auth/webauthn-lib": "^4.0",
2928
"web-token/jwt-signature": "^3.0"
@@ -38,8 +37,7 @@
3837
"phpstan/phpstan-deprecation-rules": "^1.0",
3938
"phpstan/phpstan-phpunit": "^1.0",
4039
"phpstan/phpstan-strict-rules": "^1.0",
41-
"phpunit/phpunit": "^9.5",
42-
"thecodingmachine/phpstan-safe-rule": "^1.0"
40+
"phpunit/phpunit": "^9.5"
4341
},
4442
"suggest": {
4543
"guzzlehttp/psr7": "To provide a psr/http-factory-implementation implementation",

phpstan.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
includes:
22
- ./vendor/nunomaduro/larastan/extension.neon
3-
- ./vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
43
- ./vendor/phpstan/phpstan-deprecation-rules/rules.neon
54
- ./vendor/phpstan/phpstan-strict-rules/rules.neon
65

src/Models/Casts/TrustPath.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
66
use Webauthn\TrustPath\TrustPathLoader;
77

8-
use function Safe\json_decode;
9-
use function Safe\json_encode;
10-
118
class TrustPath implements CastsAttributes
129
{
1310
/**
@@ -21,7 +18,7 @@ class TrustPath implements CastsAttributes
2118
*/
2219
public function get($model, $key, $value, $attributes): ?\Webauthn\TrustPath\TrustPath
2320
{
24-
return $value !== null ? TrustPathLoader::loadTrustPath(json_decode($value, true)) : null;
21+
return $value !== null ? TrustPathLoader::loadTrustPath(json_decode($value, true, flags: JSON_THROW_ON_ERROR)) : null;
2522
}
2623

2724
/**
@@ -35,6 +32,6 @@ public function get($model, $key, $value, $attributes): ?\Webauthn\TrustPath\Tru
3532
*/
3633
public function set($model, $key, $value, $attributes): string
3734
{
38-
return json_encode($value);
35+
return json_encode($value, flags: JSON_THROW_ON_ERROR);
3936
}
4037
}

0 commit comments

Comments
 (0)