File tree 5 files changed +7
-9
lines changed
5 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ A PHP implementation for finding unordered diff between two `JSON` documents.
5
5
[ ![ Build Status] ( https://travis-ci.org/swaggest/json-diff.svg?branch=master )] ( https://travis-ci.org/swaggest/json-diff )
6
6
[ ![ 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 )
7
7
[ ![ 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 )
9
9
10
10
## Purpose
11
11
@@ -54,7 +54,7 @@ $r = new JsonDiff(
54
54
On created object you have several handy methods.
55
55
56
56
### ` getPatch `
57
- Returns JsonPatch of difference
57
+ Returns ` JsonPatch ` of difference
58
58
59
59
### ` getRearranged `
60
60
Returns new value, rearranged with original order.
Original file line number Diff line number Diff line change 7
7
8
8
class Diff extends Base
9
9
{
10
- static function setUpDefinition (Command \Definition $ definition , $ options )
10
+ public static function setUpDefinition (Command \Definition $ definition , $ options )
11
11
{
12
12
parent ::setUpDefinition ($ definition , $ options );
13
13
$ definition ->description = 'Make patch from two json documents, output to STDOUT ' ;
Original file line number Diff line number Diff line change 7
7
8
8
class Rearrange extends Base
9
9
{
10
- static function setUpDefinition (Command \Definition $ definition , $ options )
10
+ public static function setUpDefinition (Command \Definition $ definition , $ options )
11
11
{
12
12
parent ::setUpDefinition ($ definition , $ options );
13
13
$ definition ->description = 'Rearrange json document in the order of another (original) json document ' ;
Original file line number Diff line number Diff line change @@ -27,11 +27,8 @@ class JsonPatch implements \JsonSerializable
27
27
* @return JsonPatch
28
28
* @throws Exception
29
29
*/
30
- public static function import ($ data )
30
+ public static function import (array $ data )
31
31
{
32
- if (!is_array ($ data )) {
33
- throw new Exception ('Array expected in JsonPatch::import ' );
34
- }
35
32
$ result = new JsonPatch ();
36
33
foreach ($ data as $ operation ) {
37
34
/** @var OpPath|OpPathValue|OpPathFrom $operation */
Original file line number Diff line number Diff line change @@ -75,7 +75,8 @@ public function testNull()
75
75
76
76
public function testInvalidPatch ()
77
77
{
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 ' );
79
80
JsonPatch::import (123 );
80
81
}
81
82
You can’t perform that action at this time.
0 commit comments