File tree Expand file tree Collapse file tree 5 files changed +7
-9
lines changed Expand file tree Collapse file tree 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.
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(
5454On created object you have several handy methods.
5555
5656### ` getPatch `
57- Returns JsonPatch of difference
57+ Returns ` JsonPatch ` of difference
5858
5959### ` getRearranged `
6060Returns new value, rearranged with original order.
Original file line number Diff line number Diff line change 77
88class 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 ' ;
Original file line number Diff line number Diff line change 77
88class 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 ' ;
Original file line number Diff line number Diff 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 */
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments