Skip to content

Commit 240927f

Browse files
committed
wip
Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent b2db92f commit 240927f

File tree

6 files changed

+15
-22
lines changed

6 files changed

+15
-22
lines changed

src/Bootstrap/LoadEnvironmentVariables.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class LoadEnvironmentVariables extends \Illuminate\Foundation\Bootstrap\Lo
1616
protected function createDotenv($app)
1717
{
1818
/** @phpstan-ignore method.notFound, method.notFound */
19-
if (! file_exists(implode(DIRECTORY_SEPARATOR, [$app->environmentPath(), $app->environmentFile()]))) {
19+
if (! file_exists(join_paths($app->environmentPath(), $app->environmentFile()))) {
2020
return Dotenv::create(
2121
Env::getRepository(), (string) realpath(join_paths(__DIR__, 'stubs')), '.env.testbench'
2222
);

src/Foundation/Config.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Orchestra\Testbench\Contracts\Config as ConfigContract;
99
use Symfony\Component\Yaml\Yaml;
1010

11+
use function Orchestra\Testbench\join_paths;
1112
use function Orchestra\Testbench\parse_environment_variables;
1213
use function Orchestra\Testbench\transform_relative_path;
1314

@@ -199,7 +200,7 @@ public static function loadFromYaml(string $workingPath, ?string $filename = 'te
199200
yield "{$filename}.example";
200201
yield "{$filename}.dist";
201202
})->filter(static function ($file) use ($workingPath) {
202-
return file_exists($workingPath.DIRECTORY_SEPARATOR.$file);
203+
return file_exists(join_paths($workingPath, $file));
203204
})->first();
204205

205206
if (! \is_null($filename)) {
@@ -208,11 +209,11 @@ public static function loadFromYaml(string $workingPath, ?string $filename = 'te
208209
*
209210
* @phpstan-var TOptionalConfig $config
210211
*/
211-
$config = Yaml::parseFile($workingPath.DIRECTORY_SEPARATOR.$filename);
212+
$config = Yaml::parseFile(join_paths($workingPath, $filename));
212213

213-
$config['laravel'] = transform(Arr::get($config, 'laravel'), static function ($path) use ($workingPath) {
214-
return transform_relative_path($path, $workingPath);
215-
});
214+
$config['laravel'] = transform(
215+
Arr::get($config, 'laravel'), static fn ($path) => transform_relative_path($path, $workingPath)
216+
);
216217

217218
if (isset($config['env']) && \is_array($config['env']) && Arr::isAssoc($config['env'])) {
218219
$config['env'] = parse_environment_variables($config['env']);

src/Foundation/Console/Signals.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class Signals extends \Illuminate\Console\Signals
1111
* @param callable|null $default
1212
* @return void
1313
*/
14-
#[\Override]
1514
public static function whenAvailable($callback, $default = null)
1615
{
1716
if (\is_null($resolver = static::$availabilityResolver)) {

src/Foundation/Console/TestCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ protected function phpunitArguments($options)
7676
$file = $this->phpUnitConfigurationFile();
7777

7878
return Collection::make(parent::phpunitArguments($options))
79-
->reject(static function ($option) {
80-
return str_starts_with($option, '--configuration=');
81-
})->merge(["--configuration={$file}"])
79+
->reject(static fn ($option) => str_starts_with($option, '--configuration='))
80+
->merge(["--configuration={$file}"])
8281
->all();
8382
}
8483

src/Workbench/Workbench.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ class Workbench
5252
*/
5353
public static function start(ApplicationContract $app, ConfigContract $config): void
5454
{
55-
$app->singleton(ConfigContract::class, static function () use ($config) {
56-
return $config;
57-
});
55+
$app->singleton(ConfigContract::class, static fn () => $config);
5856
}
5957

6058
/**
@@ -106,9 +104,8 @@ public static function discoverRoutes(ApplicationContract $app, ConfigContract $
106104
$path = Collection::make([
107105
workbench_path('lang'),
108106
workbench_path('resources', 'lang'),
109-
])->filter(static function ($path) {
110-
return is_dir($path);
111-
})->first();
107+
])->filter(static fn ($path) => is_dir($path))
108+
->first();
112109

113110
if (\is_null($path)) {
114111
return;

src/functions.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ function remote(array|string $command, array|string $env = []): Process
6969
{
7070
$phpBinary = transform(
7171
\defined('PHP_BINARY') ? PHP_BINARY : (new PhpExecutableFinder)->find(),
72-
static function ($phpBinary) {
73-
return ProcessUtils::escapeArgument((string) $phpBinary);
74-
}
72+
static fn ($phpBinary) => ProcessUtils::escapeArgument((string) $phpBinary)
7573
);
7674

7775
$binary = \defined('TESTBENCH_DUSK') ? 'testbench-dusk' : 'testbench';
@@ -177,9 +175,8 @@ function defined_environment_variables(): array
177175
{
178176
return Collection::make(array_merge($_SERVER, $_ENV))
179177
->keys()
180-
->mapWithKeys(static function (string $key) {
181-
return [$key => Env::forward($key)];
182-
})->unless(
178+
->mapWithKeys(static fn (string $key) => [$key => Env::forward($key)])
179+
->unless(
183180
Env::has('TESTBENCH_WORKING_PATH'), static fn ($env) => $env->put('TESTBENCH_WORKING_PATH', package_path())
184181
)->all();
185182
}

0 commit comments

Comments
 (0)