Skip to content

Commit

Permalink
[Objects] Deprecate Value Class (#26)
Browse files Browse the repository at this point in the history
Co-authored-by: onairmarc <[email protected]>
  • Loading branch information
onairmarc and onairmarc authored Oct 3, 2024
1 parent cecd287 commit af59354
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ c709aedfb70105dd006ffbbbf8f82d9716db9614
c10c3ac2613e54de290a9135afe024036174ef20
aef6f8b59ab2ff054b1a823efe242e0cb0cd1164
d521d82e9b14a5f411f3492529800c6b39f17740
11b88b5f8641574fc93d2a4f443aeaf819381c91
4 changes: 4 additions & 0 deletions DEPRECATED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# v2.0.0

- Objects\Value
- This class will be removed in v2.0.0. Use their function counterparts instead.
17 changes: 12 additions & 5 deletions src/ObjectHelpers/val_helpers.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
<?php

use EncoreDigitalGroup\StdLib\Objects\Value;

if (!function_exists('not_null')) {
function not_null(mixed $value): bool
{
return Value::notNull($value);
return !is_null($value);
}
}

if (!function_exists('val_not_null')) {
/** @deprecated Use not_null() instead. */
function val_not_null(mixed $value): bool
{
return Value::notNull($value);
return not_null($value);
}
}

if (!function_exists('val_transform_bool')) {
/** @deprecated Use validate_bool() instead. */
function val_transform_bool(mixed $value): bool
{
return Value::transformBool($value);
return validate_bool($value);
}
}

if (!function_exists('validate_bool')) {
function validate_bool(mixed $value): bool
{
return filter_var($value, FILTER_VALIDATE_BOOLEAN);
}
}
5 changes: 5 additions & 0 deletions src/Objects/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

namespace EncoreDigitalGroup\StdLib\Objects;

use EncoreDigitalGroup\StdLib\Attributes\Deprecated;

/**
* @api
*
* @deprecated
*
* @internal
*/
#[Deprecated]
class Value
{
public static function notNull(mixed $value): bool
Expand Down

0 comments on commit af59354

Please sign in to comment.