Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspertey authored and github-actions[bot] committed Sep 2, 2024
1 parent 4f4e121 commit 48f9818
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/LaravelDDDServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class LaravelDDDServiceProvider extends PackageServiceProvider
public function configurePackage(Package $package): void
{
$this->app->scoped(DomainManager::class, function () {
return new DomainManager();
return new DomainManager;
});

$this->app->bind('ddd', DomainManager::class);
Expand Down Expand Up @@ -72,6 +72,6 @@ public function packageBooted()

public function packageRegistered()
{
(new DomainAutoloader())->autoload();
(new DomainAutoloader)->autoload();
}
}
4 changes: 1 addition & 3 deletions src/Listeners/CacheClearSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

class CacheClearSubscriber
{
public function __construct()
{
}
public function __construct() {}

public function handle(): void
{
Expand Down
14 changes: 7 additions & 7 deletions src/Support/DomainAutoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function autoload(): void
protected static function normalizePaths($path): array
{
return collect($path)
->filter(fn($path) => is_dir($path))
->filter(fn ($path) => is_dir($path))
->toArray();
}

Expand Down Expand Up @@ -99,10 +99,10 @@ protected function handlePolicies(): void
return Arr::wrap(Collection::times(count($classDirnameSegments), function ($index) use ($class, $classDirnameSegments) {
$classDirname = implode('\\', array_slice($classDirnameSegments, 0, $index));

return $classDirname . '\\Policies\\' . class_basename($class) . 'Policy';
return $classDirname.'\\Policies\\'.class_basename($class).'Policy';
})->reverse()->values()->first(function ($class) {
return class_exists($class);
}) ?: [$classDirname . '\\Policies\\' . class_basename($class) . 'Policy']);
}) ?: [$classDirname.'\\Policies\\'.class_basename($class).'Policy']);
});
}

Expand All @@ -115,11 +115,11 @@ protected function handleFactories(): void

$appNamespace = static::appNamespace();

$modelName = Str::startsWith($modelName, $appNamespace . 'Models\\')
? Str::after($modelName, $appNamespace . 'Models\\')
$modelName = Str::startsWith($modelName, $appNamespace.'Models\\')
? Str::after($modelName, $appNamespace.'Models\\')
: Str::after($modelName, $appNamespace);

return 'Database\\Factories\\' . $modelName . 'Factory';
return 'Database\\Factories\\'.$modelName.'Factory';
});
}

Expand All @@ -132,7 +132,7 @@ protected static function finder($paths)
->finish('/');

$ignoredFolders = collect(config('ddd.autoload_ignore', []))
->map(fn($path) => Str::finish($path, '/'));
->map(fn ($path) => Str::finish($path, '/'));

if ($pathAfterDomain->startsWith($ignoredFolders)) {
return false;
Expand Down
3 changes: 1 addition & 2 deletions src/ValueObjects/DomainNamespaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public function __construct(
public readonly string $notifications,
public readonly string $resources,
public readonly string $rules,
) {
}
) {}

public static function from(string $domain, ?string $subdomain = null): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/ValueObjects/DomainObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public function __construct(
public readonly string $fullyQualifiedName,
public readonly string $path,
public readonly ?string $type = null,
) {
}
) {}

public static function fromClass(string $fullyQualifiedClass, ?string $objectType = null): ?self
{
Expand Down
3 changes: 1 addition & 2 deletions src/ValueObjects/DomainObjectNamespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class DomainObjectNamespace
public function __construct(
public readonly string $type,
public readonly string $namespace,
) {
}
) {}

public static function make(string $key, string $domain, ?string $subdomain = null): self
{
Expand Down
8 changes: 4 additions & 4 deletions tests/Autoload/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$this->setupTestApplication();

$this->afterApplicationCreated(function () {
(new DomainAutoloader())->autoload();
(new DomainAutoloader)->autoload();
});
});

Expand All @@ -35,7 +35,7 @@
$this->setupTestApplication();

$this->afterApplicationCreated(function () {
(new DomainAutoloader())->autoload();
(new DomainAutoloader)->autoload();
});
});

Expand Down Expand Up @@ -82,7 +82,7 @@
DomainCache::set('domain-commands', []);

$this->afterApplicationCreated(function () {
(new DomainAutoloader())->autoload();
(new DomainAutoloader)->autoload();
});

// command should not be recognized due to cached empty-state
Expand All @@ -94,7 +94,7 @@
DomainCache::clear();

$this->afterApplicationCreated(function () {
(new DomainAutoloader())->autoload();
(new DomainAutoloader)->autoload();
});

$this->artisan('invoice:deliver')->assertSuccessful();
Expand Down
4 changes: 2 additions & 2 deletions tests/Autoload/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Config::set('ddd.autoload.factories', true);

$this->afterApplicationCreated(function () {
(new DomainAutoloader())->autoload();
(new DomainAutoloader)->autoload();
});
});

Expand Down Expand Up @@ -52,7 +52,7 @@
Config::set('ddd.autoload.factories', false);

$this->afterApplicationCreated(function () {
(new DomainAutoloader())->autoload();
(new DomainAutoloader)->autoload();
});
});

Expand Down
2 changes: 1 addition & 1 deletion tests/Autoload/PolicyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Config::set('ddd.autoload.factories', true);

$this->afterApplicationCreated(function () {
(new DomainAutoloader())->autoload();
(new DomainAutoloader)->autoload();
});
});

Expand Down
8 changes: 4 additions & 4 deletions tests/Autoload/ProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
]);

$this->afterApplicationCreated(function () {
(new DomainAutoloader())->autoload();
(new DomainAutoloader)->autoload();
});
});

Expand All @@ -34,7 +34,7 @@
]);

$this->afterApplicationCreated(function () {
(new DomainAutoloader())->autoload();
(new DomainAutoloader)->autoload();
});
});

Expand All @@ -57,7 +57,7 @@
DomainCache::set('domain-providers', []);

$this->afterApplicationCreated(function () {
(new DomainAutoloader())->autoload();
(new DomainAutoloader)->autoload();
});

expect(fn () => app('invoicing'))->toThrow(Exception::class);
Expand All @@ -68,7 +68,7 @@
DomainCache::clear();

$this->afterApplicationCreated(function () {
(new DomainAutoloader())->autoload();
(new DomainAutoloader)->autoload();
});

expect(app('invoicing'))->toEqual('invoicing-singleton');
Expand Down
2 changes: 1 addition & 1 deletion tests/Support/AutoloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can run', function () {
$autoloader = new DomainAutoloader();
$autoloader = new DomainAutoloader;

$autoloader->autoload();
})->throwsNoExceptions();
3 changes: 1 addition & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ protected function composerReload()

(new Process($command, base_path(), ['COMPOSER_MEMORY_LIMIT' => '-1']))
->setTimeout(null)
->run(function ($type, $output) {
});
->run(function ($type, $output) {});
}

protected function cleanSlate()
Expand Down

0 comments on commit 48f9818

Please sign in to comment.