Skip to content

Commit

Permalink
Remove Yii JSON dependency (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik authored Dec 27, 2024
1 parent a3402f8 commit b9bc49b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"yiisoft/config": "^1.3",
"yiisoft/di": "^1.0",
"yiisoft/files": "^2.0",
"yiisoft/json": "^1.0",
"yiisoft/profiler": "^3.0",
"yiisoft/proxy": "^1.0.1",
"yiisoft/strings": "^2.2",
Expand Down
6 changes: 4 additions & 2 deletions src/Storage/FileStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Yiisoft\Yii\Debug\Storage;

use Yiisoft\Files\FileHelper;
use Yiisoft\Json\Json;
use Yiisoft\Yii\Debug\Collector\CollectorInterface;
use Yiisoft\Yii\Debug\Collector\SummaryCollectorInterface;
use Yiisoft\Yii\Debug\DebuggerIdGenerator;
Expand All @@ -16,6 +15,8 @@
use function dirname;
use function filemtime;
use function glob;
use function json_decode;
use function sprintf;
use function strlen;
use function substr;

Expand Down Expand Up @@ -62,7 +63,8 @@ public function read(string $type, ?string $id = null): array
foreach ($dataFiles as $file) {
$dir = dirname($file);
$id = substr($dir, strlen(dirname($file, 2)) + 1);
$data[$id] = Json::decode(file_get_contents($file));
$content = file_get_contents($file);
$data[$id] = $content === '' ? '' : json_decode($content, true, flags: JSON_THROW_ON_ERROR);
}

return $data;
Expand Down

0 comments on commit b9bc49b

Please sign in to comment.