Skip to content

Commit 6c07623

Browse files
committed
refactor: rename isEmptyButZero to isEmptyString
1 parent 82cac5b commit 6c07623

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/opnsense/mvc/app/models/OPNsense/Base/Constraints/ComparedToFieldConstraint.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ public function validate($validator, $attribute): bool
5454
$node = $this->getOption('node');
5555
$field_name = $this->getOption('field');
5656
$operator = $this->getOption('operator');
57-
if ($node && !($node->isEmptyButZero() || empty($operator) || empty($field_name))) {
57+
if ($node && !($node->isEmptyString() || empty($operator) || empty($field_name))) {
5858
$parent_node = $node->getParentNode();
5959
$other_node_content = $parent_node->$field_name;
6060

6161
// if the other field is not set, or invalid type -> ignore this constraint
6262
if (
63-
is_null($other_node_content) || $other_node_content->isEmptyButZero() ||
63+
is_null($other_node_content) || $other_node_content->isEmptyString() ||
6464
!$node->isNumeric() && !$other_node_content->isNumeric()
6565
) {
6666
return true;

src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ public function isEmpty(): bool
513513
* check if current value is empty AND NOT zero (either boolean field as false or an empty field)
514514
* @return bool
515515
*/
516-
public function isEmptyButZero(): bool
516+
public function isEmptyString(): bool
517517
{
518518
return $this->getCurrentValue() !== "0" && $this->isEmpty();
519519
}

0 commit comments

Comments
 (0)