Skip to content

Commit 5adc6c9

Browse files
authored
Add Deprecations (#27)
Co-authored-by: onairmarc <[email protected]>
1 parent af59354 commit 5adc6c9

21 files changed

+67
-61
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ c10c3ac2613e54de290a9135afe024036174ef20
1313
aef6f8b59ab2ff054b1a823efe242e0cb0cd1164
1414
d521d82e9b14a5f411f3492529800c6b39f17740
1515
11b88b5f8641574fc93d2a4f443aeaf819381c91
16+
f74b50a0c5a93e2042dd0899f67dc0d77d9f37b2

src/Exceptions/FilesystemExceptions/DirectoryNotFoundException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ class DirectoryNotFoundException extends BaseException
1010
public function __construct(?string $path = null)
1111
{
1212
if (is_null($path)) {
13-
$msg = str_concat_space('Unable to locate directory on line', $this->line, 'in', $this->file);
13+
$msg = "Unable to locate directory on line {$this->line} in {$this->file}";
1414
} else {
15-
$msg = str_concat_space('Unable to locate directory', $path, 'on line', $this->line, 'in', $this->file);
15+
$msg = "Unable to locate directory {$path} on line {$this->line} in {$this->file}";
1616
}
1717

1818
parent::__construct($msg, ExitCode::RESOURCE_UNAVAILABLE, $this->getPrevious());

src/Exceptions/FilesystemExceptions/FileNotFoundException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ class FileNotFoundException extends BaseException
1010
public function __construct(?string $path = null)
1111
{
1212
if (is_null($path)) {
13-
$msg = str_concat_space('Unable to locate file on line', $this->line, 'in', $this->file);
13+
$msg = "Unable to locate file on line {$this->line} in {$this->file}";
1414
} else {
15-
$msg = str_concat_space('Unable to locate file', $path, 'on line', $this->line, 'in', $this->file);
15+
$msg = "Unable to locate file {$path} on line {$this->line} in {$this->file}";
1616
}
1717

1818
parent::__construct($msg, ExitCode::RESOURCE_UNAVAILABLE, $this->getPrevious());

src/Exceptions/ImproperBooleanReturnedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __construct(bool $expected = true)
1616
$actual = 'true';
1717
}
1818

19-
$msg = str_concat_space('Improper boolean returned. Expected', $expect, 'but got', $actual);
19+
$msg = "Improper boolean returned. Expected {$expect} but got {$actual}";
2020

2121
parent::__construct($msg, ExitCode::DATA_ERROR, $this->getPrevious());
2222
}

src/Exceptions/NotImplementedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class NotImplementedException extends BaseException
88
{
99
public function __construct()
1010
{
11-
$msg = str_concat_space('Method is not implemented on line', $this->line, 'in', $this->file);
11+
$msg = "Method is not implemented on line {$this->line} in {$this->file}";
1212

1313
parent::__construct($msg, ExitCode::RESOURCE_UNAVAILABLE, $this->getPrevious());
1414
}

src/ObjectHelpers/arr_helpers.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
if (!function_exists('arr_to_short_syntax')) {
77
/**
88
* @throws ArgumentNullException
9+
*
10+
* @deprecated No Replacement
911
*/
1012
function arr_to_short_syntax(array|string $value): array|string
1113
{

src/ObjectHelpers/dir_helpers.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,43 @@
33
use EncoreDigitalGroup\StdLib\Objects\Directory;
44

55
if (!function_exists('dir_current')) {
6+
/** @deprecated */
67
function dir_current(): string
78
{
89
return Directory::current();
910
}
1011
}
1112

1213
if (!function_exists('dir_hash')) {
13-
/** @experimental */
14+
/**
15+
* @experimental
16+
*
17+
* @deprecated
18+
* */
1419
function dir_hash(string $dir): string
1520
{
1621
return Directory::hash($dir);
1722
}
1823
}
1924

2025
if (!function_exists('dir_scan')) {
21-
/** @experimental */
26+
/**
27+
* @experimental
28+
*
29+
* @deprecated
30+
*/
2231
function dir_scan(string $dir): array
2332
{
2433
return Directory::scan($dir);
2534
}
2635
}
2736

2837
if (!function_exists('dir_scan_recursive')) {
29-
/** @experimental */
38+
/**
39+
* @experimental
40+
*
41+
* @deprecated
42+
*/
3043
function dir_scan_recursive(string $path): array
3144
{
3245
return Directory::scanRecursive($path);

src/ObjectHelpers/file_helpers.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,23 @@ function file_save_contents(string $path, mixed $data): void
1212
}
1313

1414
if (!function_exists('file_copy')) {
15-
/** @throws FileNotFoundException */
15+
/**
16+
* @throws FileNotFoundException
17+
*
18+
* @deprecated
19+
*/
1620
function file_copy(string $source, string $destination): void
1721
{
1822
File::copy($source, $destination);
1923
}
2024
}
2125

2226
if (!function_exists('file_delete')) {
23-
/** @throws FileNotFoundException */
27+
/**
28+
* @throws FileNotFoundException
29+
*
30+
* @deprecated
31+
*/
2432
function file_delete(string $path): void
2533
{
2634
File::delete($path);

src/ObjectHelpers/num_helpers.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use EncoreDigitalGroup\StdLib\Objects\Number;
44

55
if (!function_exists('num_to_int')) {
6+
/** @deprecated */
67
function num_to_int(mixed $value): int
78
{
89
return Number::toInt($value);

src/ObjectHelpers/php_function_helpers.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
if (!function_exists('get_type')) {
44
/**
5-
* @noinspection PhpMissingReturnTypeInspection
6-
*
75
* @phpstan-ignore-next-line
86
*/
97
function get_type(mixed $value): string

0 commit comments

Comments
 (0)