diff --git a/composer.json b/composer.json index e797f7c..9ab2042 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,6 @@ "php": ">=8.1", "illuminate/support": "^9.0 || ^10.0", "psr/http-factory-implementation": "1.0", - "thecodingmachine/safe": "^2.0", "web-auth/cose-lib": "^4.0", "web-auth/webauthn-lib": "^4.0", "web-token/jwt-signature": "^3.0" @@ -38,8 +37,7 @@ "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5", - "thecodingmachine/phpstan-safe-rule": "^1.0" + "phpunit/phpunit": "^9.5" }, "suggest": { "guzzlehttp/psr7": "To provide a psr/http-factory-implementation implementation", diff --git a/phpstan.neon b/phpstan.neon index 47f65e0..4b046fe 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,5 @@ includes: - ./vendor/nunomaduro/larastan/extension.neon - - ./vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon - ./vendor/phpstan/phpstan-deprecation-rules/rules.neon - ./vendor/phpstan/phpstan-strict-rules/rules.neon diff --git a/src/Models/Casts/TrustPath.php b/src/Models/Casts/TrustPath.php index b2eac99..089652c 100644 --- a/src/Models/Casts/TrustPath.php +++ b/src/Models/Casts/TrustPath.php @@ -5,9 +5,6 @@ use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Webauthn\TrustPath\TrustPathLoader; -use function Safe\json_decode; -use function Safe\json_encode; - class TrustPath implements CastsAttributes { /** @@ -21,7 +18,7 @@ class TrustPath implements CastsAttributes */ public function get($model, $key, $value, $attributes): ?\Webauthn\TrustPath\TrustPath { - return $value !== null ? TrustPathLoader::loadTrustPath(json_decode($value, true)) : null; + return $value !== null ? TrustPathLoader::loadTrustPath(json_decode($value, true, flags: JSON_THROW_ON_ERROR)) : null; } /** @@ -35,6 +32,6 @@ public function get($model, $key, $value, $attributes): ?\Webauthn\TrustPath\Tru */ public function set($model, $key, $value, $attributes): string { - return json_encode($value); + return json_encode($value, flags: JSON_THROW_ON_ERROR); } }