Skip to content

Commit

Permalink
Removed tarampampam/wrappers-php (#10)
Browse files Browse the repository at this point in the history
* Removed tarampampam/wrappers-php

* CHANGELOG.md

* Update src/Back2FrontStack.php

Co-authored-by: Eldario <eldario666@gmail.com>
  • Loading branch information
Андрей Малыгин and eldario authored Apr 5, 2021
1 parent fe5d790 commit 6903671
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].

## Unreleased

### Removed

Dependency `tarampampam/wrappers-php` because this package was deprecated and removed

## v2.4.0

### Added
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"require": {
"php": "^7.3 || ^8.0",
"ext-mbstring": "*",
"ext-json": "*",
"illuminate/support": "~6.0 || ~7.0 || ~8.0",
"illuminate/view": "~6.0 || ~7.0 || ~8.0",
"illuminate/container": "~6.0 || ~7.0 || ~8.0",
"illuminate/config": "~6.0 || ~7.0 || ~8.0",
"tarampampam/wrappers-php": "^1.3 || ~2.0"
"illuminate/config": "~6.0 || ~7.0 || ~8.0"
},
"require-dev": {
"laravel/laravel": "~6.0 || ~7.0 || ~8.0",
Expand Down
6 changes: 2 additions & 4 deletions src/Back2FrontStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
namespace AvtoDev\Back2Front;

use DateTime;
use Tarampampam\Wrappers\Json;
use Illuminate\Support\Collection;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Config\Repository as ConfigRepository;
use Tarampampam\Wrappers\Exceptions\JsonEncodeDecodeException;

class Back2FrontStack extends Collection implements Back2FrontInterface
{
Expand Down Expand Up @@ -45,11 +43,11 @@ public function __construct(ConfigRepository $config)
/**
* {@inheritdoc}
*
* @throws JsonEncodeDecodeException
* @throws \JsonException
*/
public function toJson($options = 0): string
{
return Json::encode($this->toArray(), $options);
return (string) \json_encode($this->toArray(), $options | \JSON_THROW_ON_ERROR);
}

/**
Expand Down
5 changes: 2 additions & 3 deletions tests/php/Unit/Back2FrontStackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use DateTime;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Tarampampam\Wrappers\Json;
use AvtoDev\Back2Front\Back2FrontInterface;
use Illuminate\Contracts\Support\Arrayable;
use AvtoDev\Back2Front\Tests\AbstractTestCase;
Expand Down Expand Up @@ -179,7 +178,7 @@ public function testPutGetToJson(): void

$in_array = $this->service->toArray();

$parsed_data = Json::decode($this->service->toJson(), true);
$parsed_data = \json_decode($this->service->toJson(), true);

// Verifying that the array received through toArray contains the same data that was returned to toJson
$this->assertEquals($in_array, $parsed_data);
Expand All @@ -192,7 +191,7 @@ public function testPutGetToJson(): void
if (is_scalar($value)) {
$this->assertEquals($value, $parsed_data[$key]);
} else {
$this->assertEquals(Json::decode(Json::encode($value), true), $parsed_data[$key]);
$this->assertEquals(\json_decode((string) \json_encode($value), true), $parsed_data[$key]);
}
}
}
Expand Down

0 comments on commit 6903671

Please sign in to comment.