Skip to content

Commit 77c888e

Browse files
committed
code cleanup
1 parent cf093c8 commit 77c888e

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A PHP implementation for finding unordered diff between two `JSON` documents.
55
[![Build Status](https://travis-ci.org/swaggest/json-diff.svg?branch=master)](https://travis-ci.org/swaggest/json-diff)
66
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/swaggest/json-diff/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/swaggest/json-diff/?branch=master)
77
[![Code Climate](https://codeclimate.com/github/swaggest/json-diff/badges/gpa.svg)](https://codeclimate.com/github/swaggest/json-diff)
8-
[![Test Coverage](https://codeclimate.com/github/swaggest/json-diff/badges/coverage.svg)](https://codeclimate.com/github/swaggest/json-diff/coverage)
8+
[![Code Coverage](https://scrutinizer-ci.com/g/swaggest/json-diff/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/swaggest/json-diff/code-structure/master/code-coverage)
99

1010
## Purpose
1111

@@ -54,7 +54,7 @@ $r = new JsonDiff(
5454
On created object you have several handy methods.
5555

5656
### `getPatch`
57-
Returns JsonPatch of difference
57+
Returns `JsonPatch` of difference
5858

5959
### `getRearranged`
6060
Returns new value, rearranged with original order.

src/Cli/Diff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class Diff extends Base
99
{
10-
static function setUpDefinition(Command\Definition $definition, $options)
10+
public static function setUpDefinition(Command\Definition $definition, $options)
1111
{
1212
parent::setUpDefinition($definition, $options);
1313
$definition->description = 'Make patch from two json documents, output to STDOUT';

src/Cli/Rearrange.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class Rearrange extends Base
99
{
10-
static function setUpDefinition(Command\Definition $definition, $options)
10+
public static function setUpDefinition(Command\Definition $definition, $options)
1111
{
1212
parent::setUpDefinition($definition, $options);
1313
$definition->description = 'Rearrange json document in the order of another (original) json document';

src/JsonPatch.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ class JsonPatch implements \JsonSerializable
2727
* @return JsonPatch
2828
* @throws Exception
2929
*/
30-
public static function import($data)
30+
public static function import(array $data)
3131
{
32-
if (!is_array($data)) {
33-
throw new Exception('Array expected in JsonPatch::import');
34-
}
3532
$result = new JsonPatch();
3633
foreach ($data as $operation) {
3734
/** @var OpPath|OpPathValue|OpPathFrom $operation */

tests/src/JsonPatchTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ public function testNull()
7575

7676
public function testInvalidPatch()
7777
{
78-
$this->setExpectedException(get_class(new Exception()), 'Array expected in JsonPatch::import');
78+
$this->setExpectedException(get_class(new \TypeError()),
79+
'Argument 1 passed to Swaggest\JsonDiff\JsonPatch::import() must be of the type array, integer given');
7980
JsonPatch::import(123);
8081
}
8182

0 commit comments

Comments
 (0)