Skip to content

Commit

Permalink
[Directory] Create dir_scan() helper function (#5)
Browse files Browse the repository at this point in the history
Co-authored-by: onairmarc <[email protected]>
  • Loading branch information
onairmarc and onairmarc authored Jun 11, 2024
1 parent 18318f4 commit 435fc20
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ a709fafb67d0f1ee38b072390385ec486416aa3e
6be6fc90b919882151178c22ce21c5d99f3ee383
00a48bf6a894d24c9ed4c82bee6297ed24769e34
c0c6bf6fb1c3ad80ff54b7420853ecc9096ee576
d637c653da4a72e3b2b1132c1f0a4af3e0135387
4 changes: 2 additions & 2 deletions .github/workflows/_pullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ jobs:
branch: ${{ github.head_ref }}
path: 'src/'
Test:
needs: StaticAnalysis
needs: Duster
name: Test
uses: EncoreDigitalGroup/.github/.github/workflows/pest.yml@v1
with:
phpVersion: '8.3'
branch: ${{ github.head_ref }}
AutoMerge:
needs: Test
needs: [ StaticAnalysis, Test ]
name: AutoMerge
uses: EncoreDigitalGroup/.github/.github/workflows/dependabotAutoMerge.yml@v1
8 changes: 8 additions & 0 deletions src/ObjectHelpers/dir_helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ function dir_hash(string $dir): string
return Directory::hash($dir);
}
}

if (!function_exists('dir_scan')) {
/** @experimental */
function dir_scan(string $dir): array
{
return Directory::scan($dir);
}
}
2 changes: 1 addition & 1 deletion src/ObjectHelpers/str_helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function str_concat(mixed ...$str): string
/**@param array<string, string> ...$str */
function str_concat_space(mixed ...$str): string
{
return Str::concatSpace($str);
return Str::concatSpace($str); //@phpstan-ignore-line
}
}

Expand Down
12 changes: 9 additions & 3 deletions src/Objects/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,18 @@ public static function concat(mixed ...$str): string
return implode('', $str);
}

/**@param array<string, string> ...$str */
/**
* @param array<string, string> ...$str
*
* @deprecated No replacement.
*
* @codeCoverageIgnore deprecated
*/
public static function concatSpace(mixed ...$str): string
{
$str = array_merge(...$str);
$str = array_merge($str);

return implode(' ', $str);
return implode(' ', $str); //@phpstan-ignore-line
}

public static function guid(): string
Expand Down
8 changes: 0 additions & 8 deletions tests/Unit/StringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
expect($result)->toEqual('HelloWorld');
});

test('concatSpace method concatenates strings with a space', function () {
$strings = ['Hello', 'World'];

$result = Str::concatSpace(...$strings);

expect($result)->toEqual('Hello World');
});

test('guid method returns a UUID', function () {
$result = Str::guid();

Expand Down

0 comments on commit 435fc20

Please sign in to comment.