Skip to content

Commit

Permalink
refactor: remove thecodingmachine/safe dependency (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Sep 3, 2023
1 parent d3da820 commit 1400e5b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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",
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -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

Expand Down
7 changes: 2 additions & 5 deletions src/Models/Casts/TrustPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/**
Expand All @@ -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;
}

/**
Expand All @@ -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);
}
}

0 comments on commit 1400e5b

Please sign in to comment.