Skip to content

Commit af59354

Browse files
authored
[Objects] Deprecate Value Class (#26)
Co-authored-by: onairmarc <[email protected]>
1 parent cecd287 commit af59354

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ c709aedfb70105dd006ffbbbf8f82d9716db9614
1212
c10c3ac2613e54de290a9135afe024036174ef20
1313
aef6f8b59ab2ff054b1a823efe242e0cb0cd1164
1414
d521d82e9b14a5f411f3492529800c6b39f17740
15+
11b88b5f8641574fc93d2a4f443aeaf819381c91

DEPRECATED.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# v2.0.0
2+
3+
- Objects\Value
4+
- This class will be removed in v2.0.0. Use their function counterparts instead.

src/ObjectHelpers/val_helpers.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
<?php
22

3-
use EncoreDigitalGroup\StdLib\Objects\Value;
4-
53
if (!function_exists('not_null')) {
64
function not_null(mixed $value): bool
75
{
8-
return Value::notNull($value);
6+
return !is_null($value);
97
}
108
}
119

1210
if (!function_exists('val_not_null')) {
11+
/** @deprecated Use not_null() instead. */
1312
function val_not_null(mixed $value): bool
1413
{
15-
return Value::notNull($value);
14+
return not_null($value);
1615
}
1716
}
1817

1918
if (!function_exists('val_transform_bool')) {
19+
/** @deprecated Use validate_bool() instead. */
2020
function val_transform_bool(mixed $value): bool
2121
{
22-
return Value::transformBool($value);
22+
return validate_bool($value);
23+
}
24+
}
25+
26+
if (!function_exists('validate_bool')) {
27+
function validate_bool(mixed $value): bool
28+
{
29+
return filter_var($value, FILTER_VALIDATE_BOOLEAN);
2330
}
2431
}

src/Objects/Value.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
namespace EncoreDigitalGroup\StdLib\Objects;
44

5+
use EncoreDigitalGroup\StdLib\Attributes\Deprecated;
6+
57
/**
68
* @api
79
*
10+
* @deprecated
11+
*
812
* @internal
913
*/
14+
#[Deprecated]
1015
class Value
1116
{
1217
public static function notNull(mixed $value): bool

0 commit comments

Comments
 (0)