Skip to content

Commit 09f5012

Browse files
committed
renaming OBJECT_MERGE_UNDEFINED -> OBJECT_MERGE_UNDEFINED_VALUE
1 parent 607a12e commit 09f5012

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

Diff for: files/constants.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
const OBJECT_MERGE_OPT_MERGE_ARRAY_VALUES = 0x4;
2323
const OBJECT_MERGE_OPT_NULL_AS_UNDEFINED = 0x8;
2424

25-
define('OBJECT_MERGE_UNDEFINED', uniqid('__OBJECT_MERGE_UNDEFINED_'));
25+
define('OBJECT_MERGE_UNDEFINED_VALUE', uniqid('__OBJECT_MERGE_UNDEFINED_VALUE_'));

Diff for: files/functions.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818

1919
use DCarbone\ObjectMerge;
2020

21-
if (!function_exists('object_merge_value_undefined')) {
21+
if (!function_exists('is_object_merge_undefined_value')) {
2222
/**
2323
* @param mixed $value
2424
* @param int $opts
2525
* @return bool
2626
*/
27-
function object_merge_value_undefined($value, $opts = 0)
27+
function is_object_merge_undefined_value($value, $opts = 0)
2828
{
2929
if (null === $value && 0 !== ($opts & OBJECT_MERGE_OPT_NULL_AS_UNDEFINED)) {
3030
return true;
3131
}
32-
return $value === OBJECT_MERGE_UNDEFINED;
32+
return $value === OBJECT_MERGE_UNDEFINED_VALUE;
3333
}
3434
}
3535

Diff for: src/ObjectMerge.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ private static function _mergeArrayValues(array $leftValue, array $rightValue)
274274
$rightDefined = array_key_exists($i, $rightValue);
275275
$out[$i] = self::_mergeValues(
276276
$i,
277-
$leftDefined ? $leftValue[$i] : OBJECT_MERGE_UNDEFINED,
278-
$rightDefined ? $rightValue[$i] : OBJECT_MERGE_UNDEFINED
277+
$leftDefined ? $leftValue[$i] : OBJECT_MERGE_UNDEFINED_VALUE,
278+
$rightDefined ? $rightValue[$i] : OBJECT_MERGE_UNDEFINED_VALUE
279279
);
280280
}
281281
} else {
@@ -314,8 +314,8 @@ private static function _mergeObjectValues(stdClass $leftValue, stdClass $rightV
314314
foreach (array_keys(get_object_vars($leftValue) + get_object_vars($rightValue)) as $key) {
315315
$out->{$key} = self::_mergeValues(
316316
$key,
317-
property_exists($leftValue, $key) ? $leftValue->{$key} : OBJECT_MERGE_UNDEFINED,
318-
property_exists($rightValue, $key) ? $rightValue->{$key} : OBJECT_MERGE_UNDEFINED
317+
property_exists($leftValue, $key) ? $leftValue->{$key} : OBJECT_MERGE_UNDEFINED_VALUE,
318+
property_exists($rightValue, $key) ? $rightValue->{$key} : OBJECT_MERGE_UNDEFINED_VALUE
319319
);
320320
}
321321

@@ -340,7 +340,7 @@ private static function _mergeValues($key, $leftValue, $rightValue)
340340
if (self::OBJECT_T === $resT) {
341341
if ($res instanceof ObjectMergeResult && !$res->shouldContinue()) {
342342
$finalValue = $res->getFinalValue();
343-
if (OBJECT_MERGE_UNDEFINED !== $finalValue) {
343+
if (OBJECT_MERGE_UNDEFINED_VALUE !== $finalValue) {
344344
return $finalValue;
345345
}
346346
$leftValue = $res->getLeftValue();
@@ -351,8 +351,8 @@ private static function _mergeValues($key, $leftValue, $rightValue)
351351
}
352352
}
353353

354-
$leftUndefined = object_merge_value_undefined($leftValue, self::$_opts);
355-
$rightUndefined = object_merge_value_undefined($rightValue, self::$_opts);
354+
$leftUndefined = is_object_merge_undefined_value($leftValue, self::$_opts);
355+
$rightUndefined = is_object_merge_undefined_value($rightValue, self::$_opts);
356356

357357
if ($leftUndefined && $rightUndefined) {
358358
if (self::_optSet(OBJECT_MERGE_OPT_NULL_AS_UNDEFINED)) {

Diff for: src/ObjectMergeResult.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,23 @@ public function shouldContinue()
8080
*/
8181
public function getFinalValue()
8282
{
83-
return (isset($this->finalValue) || null === $this->finalValue) ? $this->finalValue : OBJECT_MERGE_UNDEFINED;
83+
return (isset($this->finalValue) || null === $this->finalValue) ? $this->finalValue : OBJECT_MERGE_UNDEFINED_VALUE;
8484
}
8585

8686
/**
8787
* @return mixed
8888
*/
8989
public function getLeftValue()
9090
{
91-
return (isset($this->leftValue) || null === $this->leftValue) ? $this->leftValue : OBJECT_MERGE_UNDEFINED;
91+
return (isset($this->leftValue) || null === $this->leftValue) ? $this->leftValue : OBJECT_MERGE_UNDEFINED_VALUE;
9292
}
9393

9494
/**
9595
* @return mixed
9696
*/
9797
public function getRightValue()
9898
{
99-
return (isset($this->rightValue) || null === $this->rightValue) ? $this->rightValue : OBJECT_MERGE_UNDEFINED;
99+
return (isset($this->rightValue) || null === $this->rightValue) ? $this->rightValue : OBJECT_MERGE_UNDEFINED_VALUE;
100100
}
101101

102102
/**

0 commit comments

Comments
 (0)