Skip to content

Commit 0ba2921

Browse files
committed
Renaming valueCmp to equal
1 parent 1f0d130 commit 0ba2921

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/TreeCompiler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,9 @@ private function visit_comparator(array $node)
382382
->write('%s = $value;', [$b]);
383383

384384
if ($node['value'] == '==') {
385-
$this->write('$result = Utils::valueCmp(%s, %s);', [$a, $b]);
385+
$this->write('$result = Utils::equal(%s, %s);', [$a, $b]);
386386
} elseif ($node['value'] == '!=') {
387-
$this->write('$result = !Utils::valueCmp(%s, %s);', [$a, $b]);
387+
$this->write('$result = !Utils::equal(%s, %s);', [$a, $b]);
388388
} else {
389389
$this->write(
390390
'$result = is_int(%s) && is_int(%s) && %s %s %s;',

src/TreeInterpreter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ private function dispatch(array $node, $value)
166166
$left = $this->dispatch($node['children'][0], $value);
167167
$right = $this->dispatch($node['children'][1], $value);
168168
if ($node['value'] == '==') {
169-
return Utils::valueCmp($left, $right);
169+
return Utils::equal($left, $right);
170170
} elseif ($node['value'] == '!=') {
171-
return !Utils::valueCmp($left, $right);
171+
return !Utils::equal($left, $right);
172172
} else {
173173
return self::relativeCmp($left, $right, $node['value']);
174174
}

src/Utils.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ public static function isArray($value)
9292
*
9393
* @return bool
9494
*/
95-
public static function valueCmp($a, $b)
95+
public static function equal($a, $b)
9696
{
9797
if ($a === $b) {
9898
return true;
9999
} elseif ($a instanceof \stdClass) {
100-
return self::valueCmp((array) $a, $b);
100+
return self::equal((array) $a, $b);
101101
} elseif ($b instanceof \stdClass) {
102-
return self::valueCmp($a, (array) $b);
102+
return self::equal($a, (array) $b);
103103
} else {
104104
return false;
105105
}

0 commit comments

Comments
 (0)