File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
55and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
66
7+ ## [ 3.10.2] - 2022-11-08
8+
9+ ### Added
10+ - Exceptions improved, [ #60 ] ( https://github.com/swaggest/json-diff/pull/59 ) .
11+
712## [ 3.10.1] - 2022-10-24
813
914### Added
@@ -85,6 +90,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8590### Added
8691- Compatibility option to ` TOLERATE_ASSOCIATIVE_ARRAYS ` that mimic JSON objects.
8792
93+ [ 3.10.2 ] : https://github.com/swaggest/json-diff/compare/v3.10.1...v3.10.2
8894[ 3.10.1 ] : https://github.com/swaggest/json-diff/compare/v3.10.0...v3.10.1
8995[ 3.10.0 ] : https://github.com/swaggest/json-diff/compare/v3.9.0...v3.10.0
9096[ 3.9.0 ] : https://github.com/swaggest/json-diff/compare/v3.8.3...v3.9.0
Original file line number Diff line number Diff line change @@ -70,13 +70,6 @@ public static function import(array $data)
7070 throw new MissingFieldException ('path ' , $ operation );
7171 }
7272
73- if (!is_string ($ operation ->op )) {
74- throw new InvalidFieldTypeException ('op ' , 'string ' , $ operation );
75- }
76- if (!is_string ($ operation ->path )) {
77- throw new InvalidFieldTypeException ('path ' , 'string ' , $ operation );
78- }
79-
8073 $ op = null ;
8174 switch ($ operation ->op ) {
8275 case Add::OP :
@@ -98,8 +91,17 @@ public static function import(array $data)
9891 $ op = new Test ();
9992 break ;
10093 default :
94+ if (!is_string ($ operation ->op )) {
95+ throw new InvalidFieldTypeException ('op ' , 'string ' , $ operation );
96+ }
97+
10198 throw new UnknownOperationException ($ operation );
10299 }
100+
101+ if (!is_string ($ operation ->path )) {
102+ throw new InvalidFieldTypeException ('path ' , 'string ' , $ operation );
103+ }
104+
103105 $ op ->path = $ operation ->path ;
104106 if ($ op instanceof OpPathValue) {
105107 if (property_exists ($ operation , 'value ' )) {
You can’t perform that action at this time.
0 commit comments