Skip to content

Commit 1fa6c3b

Browse files
committed
Fix lint
1 parent 28b23ce commit 1fa6c3b

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/JsonPatch.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ public static function import(array $data)
9292
}
9393
$op->path = $operation->path;
9494
if ($op instanceof OpPathValue) {
95-
if (!array_key_exists('value', (array)$operation)) {
95+
if (property_exists($operation, 'value')) {
96+
$op->value = $operation->value;
97+
} else {
9698
throw new Exception('Missing "value" in operation data');
9799
}
98-
$op->value = $operation->value;
99100
} elseif ($op instanceof OpPathFrom) {
100101
if (!isset($operation->from)) {
101102
throw new Exception('Missing "from" in operation data');

src/JsonPointer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,16 @@ public static function add(&$holder, $pathItems, $value, $flags = self::RECURSIV
136136
if ('-' === $key) {
137137
$ref = &$ref[];
138138
} else {
139-
if (is_array($ref) && array_key_exists($key, $ref) && empty($pathItems)) {
140-
array_splice($ref, $key, 0, array($value));
141-
}
142139
if (false === $intKey) {
143140
if (0 === ($flags & self::TOLERATE_ASSOCIATIVE_ARRAYS)) {
144141
throw new Exception('Invalid key for array operation');
145142
}
146143
$ref = &$ref[$key];
147144
continue;
148145
}
146+
if (is_array($ref) && array_key_exists($key, $ref) && empty($pathItems)) {
147+
array_splice($ref, $intKey, 0, array($value));
148+
}
149149
if (0 === ($flags & self::TOLERATE_ASSOCIATIVE_ARRAYS)) {
150150
if ($intKey > count($ref) && 0 === ($flags & self::RECURSIVE_KEY_CREATION)) {
151151
throw new Exception('Index is greater than number of items in array');

src/JsonValueReplace.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function process($data)
4848
}
4949
}
5050

51+
/** @var string[] $originalKeys */
5152
$originalKeys = $data instanceof \stdClass ? get_object_vars($data) : $data;
5253

5354
if ($check) {

0 commit comments

Comments
 (0)