Skip to content

Commit 0887d3c

Browse files
committed
refactor(Concerns): Rename WithRunable to WithRunnable
- Correct the spelling of the trait and its references across files. - Update the JSON configuration to reflect the correct spelling. - Ensures consistency and clarity in the codebase. Signed-off-by: guanguans <[email protected]>
1 parent b151111 commit 0887d3c

File tree

7 files changed

+4
-71
lines changed

7 files changed

+4
-71
lines changed

composer-dependency-analyser.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@
3737
],
3838
[ErrorType::SHADOW_DEPENDENCY],
3939
)
40-
->ignoreErrorsOnPackageAndPath(
41-
'illuminate/collections',
42-
__DIR__.'/src/Support/helpers.php',
43-
[ErrorType::SHADOW_DEPENDENCY]
44-
)
4540
->ignoreErrorsOnPackageAndPath(
4641
'symfony/var-dumper',
4742
__DIR__.'/src/Concerns/WithDumpable.php',

peck.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"sudo",
66
"makeable",
77
"dumpable",
8-
"runable"
8+
"runnable"
99
],
1010
"paths": []
1111
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* @mixin \Guanguans\SoarPHP\Soar
2020
*/
21-
trait WithRunable
21+
trait WithRunnable
2222
{
2323
/** @var null|\Closure(Process): Process */
2424
protected ?\Closure $pipe = null;

src/Soar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Guanguans\SoarPHP\Concerns\HasSudoPassword;
2121
use Guanguans\SoarPHP\Concerns\Makeable;
2222
use Guanguans\SoarPHP\Concerns\WithDumpable;
23-
use Guanguans\SoarPHP\Concerns\WithRunable;
23+
use Guanguans\SoarPHP\Concerns\WithRunnable;
2424
use Symfony\Component\Process\Process;
2525

2626
class Soar implements \ArrayAccess, \Stringable, Contracts\Soar
@@ -32,7 +32,7 @@ class Soar implements \ArrayAccess, \Stringable, Contracts\Soar
3232
use HasSudoPassword;
3333
use Makeable;
3434
use WithDumpable;
35-
use WithRunable;
35+
use WithRunnable;
3636

3737
public function __construct(array $options = [], ?string $binary = null)
3838
{

src/Support/helpers.php

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -13,59 +13,6 @@
1313

1414
namespace Guanguans\SoarPHP\Support;
1515

16-
use Composer\Autoload\ClassLoader;
17-
use Illuminate\Support\Collection;
18-
19-
if (!\function_exists('Guanguans\SoarPHP\Support\classes')) {
20-
/**
21-
* @see https://github.com/illuminate/collections
22-
* @see https://github.com/alekitto/class-finder
23-
* @see https://github.com/ergebnis/classy
24-
* @see https://gitlab.com/hpierce1102/ClassFinder
25-
* @see https://packagist.org/packages/haydenpierce/class-finder
26-
* @see \get_declared_classes()
27-
* @see \get_declared_interfaces()
28-
* @see \get_declared_traits()
29-
* @see \DG\BypassFinals::enable()
30-
* @see \Composer\Util\ErrorHandler
31-
* @see \Monolog\ErrorHandler
32-
* @see \PhpCsFixer\ExecutorWithoutErrorHandler
33-
* @see \Phrity\Util\ErrorHandler
34-
*
35-
* @template TObject of object
36-
*
37-
* @internal
38-
*
39-
* @param null|(callable(class-string<TObject>, string): bool) $filter
40-
*
41-
* @return \Illuminate\Support\Collection<class-string<TObject>, \ReflectionClass<TObject>|\Throwable>
42-
*
43-
* @noinspection PhpUndefinedNamespaceInspection
44-
*/
45-
function classes(?callable $filter = null): Collection
46-
{
47-
$filter ??= static fn (string $_, string $__): bool => true;
48-
49-
/** @var null|\Illuminate\Support\Collection $classes */
50-
static $classes;
51-
$classes ??= collect(spl_autoload_functions())->flatMap(
52-
static fn (callable $loader): array => \is_array($loader) && $loader[0] instanceof ClassLoader
53-
? $loader[0]->getClassMap()
54-
: []
55-
);
56-
57-
return $classes
58-
->filter(static fn (string $file, string $class): bool => $filter($class, $file))
59-
->mapWithKeys(static function (string $_, string $class): array {
60-
try {
61-
return [$class => new \ReflectionClass($class)];
62-
} catch (\Throwable $throwable) {
63-
return [$class => $throwable];
64-
}
65-
});
66-
}
67-
}
68-
6916
if (!\function_exists('Guanguans\SoarPHP\Support\str_snake')) {
7017
function str_snake(string $value, string $delimiter = '-'): string
7118
{

tests/Support/HelpersTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,8 @@
1919
* @see https://github.com/guanguans/soar-php
2020
*/
2121

22-
use Illuminate\Support\Collection;
23-
use function Guanguans\SoarPHP\Support\classes;
2422
use function Guanguans\SoarPHP\Support\str_snake;
2523

26-
it('can get classes', function (): void {
27-
expect(classes(fn (string $class): bool => str($class)->startsWith('Illuminate\Support')))
28-
->toBeInstanceOf(Collection::class)
29-
->groupBy(fn (object $object): bool => $object instanceof ReflectionClass)
30-
->toHaveCount(2);
31-
})->group(__DIR__, __FILE__);
32-
3324
it('can snake string', function (): void {
3425
expect(str_snake(__FILE__))->toBe(str(__FILE__)->snake('-')->toString());
3526
})->group(__DIR__, __FILE__);

0 commit comments

Comments
 (0)