Skip to content

Commit

Permalink
🚨 Run Pint (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x authored Aug 12, 2024
1 parent c1c2f57 commit dce6d72
Show file tree
Hide file tree
Showing 24 changed files with 56 additions and 56 deletions.
6 changes: 3 additions & 3 deletions src/Roots/Acorn/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected function registerBaseBindings()
protected function registerPackageManifest()
{
$this->singleton(FoundationPackageManifest::class, function () {
$files = new Filesystem();
$files = new Filesystem;

$composerPaths = collect(get_option('active_plugins'))
->map(fn ($plugin) => WP_PLUGIN_DIR.DIRECTORY_SEPARATOR.dirname($plugin))
Expand Down Expand Up @@ -307,7 +307,7 @@ public function registerConfiguredProviders()

$providers->splice(1, 0, [$this->make(PackageManifest::class)->providers()]);

(new ProviderRepository($this, new Filesystem(), $this->getCachedServicesPath()))
(new ProviderRepository($this, new Filesystem, $this->getCachedServicesPath()))
->load($providers->collapse()->toArray());
}

Expand Down Expand Up @@ -402,7 +402,7 @@ public function getNamespace()
*/
protected function getAppComposer(): string
{
return (new Filesystem())->closest($this->path(), 'composer.json') ?? $this->basePath('composer.json');
return (new Filesystem)->closest($this->path(), 'composer.json') ?? $this->basePath('composer.json');
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Roots/Acorn/Application/Concerns/Bootable.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ protected function bootConsole(): void
$kernel = $this->make(ConsoleKernelContract::class);

$status = $kernel->handle(
$input = new \Symfony\Component\Console\Input\ArgvInput(),
new \Symfony\Component\Console\Output\ConsoleOutput()
$input = new \Symfony\Component\Console\Input\ArgvInput,
new \Symfony\Component\Console\Output\ConsoleOutput
);

$kernel->terminate($input, $status);
Expand Down Expand Up @@ -90,7 +90,7 @@ protected function bootWpCli(): void

$status = $kernel->handle(
$input = new \Symfony\Component\Console\Input\StringInput($command),
new \Symfony\Component\Console\Output\ConsoleOutput()
new \Symfony\Component\Console\Output\ConsoleOutput
);

$kernel->terminate($input, $status);
Expand Down
2 changes: 1 addition & 1 deletion src/Roots/Acorn/Assets/Asset/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function relativePath(string $basePath): string
{
$basePath = rtrim($basePath, '/\\').'/';

return (new Filesystem())->getRelativePath($basePath, $this->path());
return (new Filesystem)->getRelativePath($basePath, $this->path());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Roots/Acorn/Assets/AssetsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function boot()
if ($this->app->bound('view')) {
$this->app->make('view')
->getEngineResolver()->resolve('blade')->getCompiler()
->directive('asset', new BladeDirective());
->directive('asset', new BladeDirective);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Roots/Acorn/Assets/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected function pipeline(array $config): array
{
return array_reduce($this->middleware, function (array $config, $middleware): array {
if (is_string($middleware) && class_exists($middleware)) {
$middleware = new $middleware();
$middleware = new $middleware;
}

return is_callable($middleware) ? $middleware($config) : $middleware->handle($config);
Expand Down
2 changes: 1 addition & 1 deletion src/Roots/Acorn/Bootstrap/RegisterConsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function bootstrap(Application $app)

$command = str_replace('\\', '\\\\', $command);

$status = $kernel->handle($input = new StringInput($command), new ConsoleOutput());
$status = $kernel->handle($input = new StringInput($command), new ConsoleOutput);

$kernel->terminate($input, $status);

Expand Down
2 changes: 1 addition & 1 deletion src/Roots/Acorn/ComposerScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ComposerScripts extends FoundationComposerScripts
*/
protected static function clearCompiled()
{
$console = new Console(new Filesystem(), getcwd());
$console = new Console(new Filesystem, getcwd());

$console->configClear();
$console->clearCompiled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function gracefulCall($command, array $arguments = [])
public function gracefulCallSilent($command, array $arguments = [])
{
if ($this->commandExists($command)) {
return $this->runCommand($command, $arguments, new NullOutput());
return $this->runCommand($command, $arguments, new NullOutput);
}

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ class WhoopsExceptionRenderer extends FoundationWhoopsExceptionRenderer
*/
protected function whoopsHandler()
{
return (new WhoopsHandler())->forDebug();
return (new WhoopsHandler)->forDebug();
}
}
2 changes: 1 addition & 1 deletion src/Roots/Acorn/Exceptions/Whoops/WhoopsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class WhoopsHandler extends FoundationWhoopsHandler
*/
public function forDebug()
{
return tap(new PrettyPageHandler(), function ($handler) {
return tap(new PrettyPageHandler, function ($handler) {
$handler->handleUnconditionally(true);

$this->registerApplicationPaths($handler)
Expand Down
2 changes: 1 addition & 1 deletion src/Roots/Acorn/Filesystem/FilesystemServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class FilesystemServiceProvider extends FilesystemServiceProviderBase
*/
protected function registerNativeFilesystem()
{
$this->app->singleton('files', fn () => new Filesystem());
$this->app->singleton('files', fn () => new Filesystem);

$this->app->alias('files', \Roots\Acorn\Filesystem\Filesystem::class);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Roots/Acorn/Providers/AcornServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected function registerPostInitEvent()
return;
}

$files = new Filesystem();
$files = new Filesystem;

$files->deleteDirectory(WP_CONTENT_DIR.'/cache/acorn');
});
Expand Down
2 changes: 1 addition & 1 deletion src/Roots/Acorn/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ final class ServiceProvider extends ServiceProviderBase
*/
public static function defaultProviders()
{
return new DefaultProviders();
return new DefaultProviders;
}
}
2 changes: 1 addition & 1 deletion src/Roots/Acorn/View/ViewServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function attachComposers()
$namespace = $this->app->getNamespace();

// TODO: This should be cacheable, perhaps via `wp acorn` command
foreach ((new Finder())->in($path)->files() as $composer) {
foreach ((new Finder)->in($path)->files() as $composer) {
$composer = $namespace.str_replace(
['/', '.php'],
['\\', ''],
Expand Down
20 changes: 10 additions & 10 deletions tests/Application/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
});

it('rejects invalid custom path types', function () {
$app = new Application();
$app = new Application;

$app->usePaths([
'app' => $this->fixture('use_paths/app'),
Expand Down Expand Up @@ -83,7 +83,7 @@
});

it('goes down for maintenance when acorn maintenance file exists', function () {
$app = new Application();
$app = new Application;

expect($app->isDownForMaintenance())->toBeFalse();

Expand All @@ -93,7 +93,7 @@
});

it('goes down for maintenance when wordpress maintenance file exists', function () {
$app = new Application();
$app = new Application;

expect($app->isDownForMaintenance())->toBeFalse();

Expand Down Expand Up @@ -129,16 +129,16 @@
});

it('makes a thing', function () {
$app = new Application();
$app = new Application;

$app->bind('config', fn () => new ConfigRepository());
$app->bind('config', fn () => new ConfigRepository);

expect($app->make('config'))->toBeInstanceOf(ConfigRepository::class);
});

it('boots a provider', function () {
$provider = mock(BootableServiceProvider::class)->makePartial();
$app = new Application();
$app = new Application;

$provider->shouldReceive('register', 'boot')->once();

Expand All @@ -150,7 +150,7 @@
it('gracefully skips a provider that fails to boot', function () {
$handler = mock(\Illuminate\Contracts\Debug\ExceptionHandler::class);
$manifest = mock(\Roots\Acorn\PackageManifest::class);
$app = new Application();
$app = new Application;

$app['env'] = 'not-local-dev';

Expand All @@ -163,7 +163,7 @@
{
public function boot()
{
new \kjo();
new \kjo;
}
};

Expand All @@ -184,7 +184,7 @@ public function boot()
it('gracefully skips a provider that does not exist', function () {
$handler = mock(\Illuminate\Contracts\Debug\ExceptionHandler::class);
$manifest = mock(\Roots\Acorn\PackageManifest::class);
$app = new Application();
$app = new Application;

$app['env'] = 'not-local-dev';

Expand All @@ -206,7 +206,7 @@ public function boot()
});

it('uses custom aliases', function () {
$app = new Application();
$app = new Application;

expect($app->getAlias(\Roots\Acorn\Application::class))->toBe('app');
expect($app->getAlias(\Roots\Acorn\PackageManifest::class))->toBe(\Illuminate\Foundation\PackageManifest::class);
Expand Down
8 changes: 4 additions & 4 deletions tests/Assets/AssetsHelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
uses(TestCase::class);

it('asset() can access the default manifest', function () {
$app = new \Roots\Acorn\Application();
$app = new \Roots\Acorn\Application;
$app->singleton('config', fn () => new \Illuminate\Config\Repository([
'assets' => [
'default' => 'app',
Expand All @@ -35,7 +35,7 @@
});

it('asset() can access a specified manifest', function () {
$app = new \Roots\Acorn\Application();
$app = new \Roots\Acorn\Application;
$app->singleton('config', fn () => new \Illuminate\Config\Repository([
'assets' => [
'default' => 'app',
Expand All @@ -61,7 +61,7 @@
});

it('bundle() can access the default manifest', function () {
$app = new \Roots\Acorn\Application();
$app = new \Roots\Acorn\Application;
$app->singleton('config', fn () => new \Illuminate\Config\Repository([
'assets' => [
'default' => 'app',
Expand All @@ -87,7 +87,7 @@
});

it('bundle() can access a specified manifest', function () {
$app = new \Roots\Acorn\Application();
$app = new \Roots\Acorn\Application;
$app->singleton('config', fn () => new \Illuminate\Config\Repository([
'assets' => [
'default' => 'app',
Expand Down
6 changes: 3 additions & 3 deletions tests/Assets/AssetsServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
uses(TestCase::class);

it('registers an asset manager', function () {
$app = new \Roots\Acorn\Application();
$app->singleton('config', fn () => new \Illuminate\Config\Repository());
$app = new \Roots\Acorn\Application;
$app->singleton('config', fn () => new \Illuminate\Config\Repository);
$app->register(\Roots\Acorn\Assets\AssetsServiceProvider::class);

expect($app->make('assets'))->toBeInstanceOf(Manager::class);
});

it('registers a default manifest', function () {
$app = new \Roots\Acorn\Application();
$app = new \Roots\Acorn\Application;
$app->singleton('config', fn () => new \Illuminate\Config\Repository([
'assets' => [
'default' => 'app',
Expand Down
2 changes: 1 addition & 1 deletion tests/Assets/BladeDirectiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
uses(TestCase::class);

it('loads an asset', function () {
$directive = new BladeDirective();
$directive = new BladeDirective;
assertMatchesSnapshot($directive("'kjo'"));
});
4 changes: 2 additions & 2 deletions tests/Assets/LaravelMixMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
uses(TestCase::class);

it('skips url modification if hot file is absent', function () {
$middleware = new LaravelMixMiddleware();
$middleware = new LaravelMixMiddleware;

$config = $middleware->handle([
'path' => $this->fixture('mix_no_bundle/public'),
Expand All @@ -19,7 +19,7 @@
});

it('modifies url when hot file is present', function () {
$middleware = new LaravelMixMiddleware();
$middleware = new LaravelMixMiddleware;

$config = $middleware->handle([
'path' => $this->fixture('mix_no_bundle_hmr/public'),
Expand Down
4 changes: 2 additions & 2 deletions tests/Assets/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
uses(TestCase::class);

it('creates a manifest', function () {
$assets = new Manager();
$assets = new Manager;

$manifest = $assets->manifest('theme', [
'path' => $this->fixture('bud_single_runtime'),
Expand All @@ -23,7 +23,7 @@
});

it('registers a manifest', function () {
$assets = new Manager();
$assets = new Manager;

$assets->register('theme', new Manifest(
$this->fixture('bud_single_runtime'),
Expand Down
2 changes: 1 addition & 1 deletion tests/Bootstrap/HandleExceptionsRegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
->shouldreceive('runningInConsole')
->andReturn(false);
$this->application->config = new Config(['app' => ['debug' => true]]);
$this->handleExceptions = new HandleExceptions();
$this->handleExceptions = new HandleExceptions;
});

it('registers error handler', function () {
Expand Down
6 changes: 3 additions & 3 deletions tests/Bootstrap/HandleExceptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
uses(TestCase::class);

beforeEach(function () {
$this->container = Application::setInstance(new Application());
$this->config = new Config();
$this->container = Application::setInstance(new Application);
$this->config = new Config;

$this->config->set('app.debug', true);

$this->container->singleton('config', fn () => $this->config);

$this->container->bootstrapWith([]);

$this->handleExceptions = new HandleExceptions();
$this->handleExceptions = new HandleExceptions;

with(new ReflectionClass($this->handleExceptions), function ($reflection) {
$property = tap($reflection->getProperty('app'))->setAccessible(true);
Expand Down
Loading

0 comments on commit dce6d72

Please sign in to comment.