diff --git a/src/LaravelDDDServiceProvider.php b/src/LaravelDDDServiceProvider.php index 7c38d21..6555823 100644 --- a/src/LaravelDDDServiceProvider.php +++ b/src/LaravelDDDServiceProvider.php @@ -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); @@ -72,6 +72,6 @@ public function packageBooted() public function packageRegistered() { - (new DomainAutoloader())->autoload(); + (new DomainAutoloader)->autoload(); } } diff --git a/src/Listeners/CacheClearSubscriber.php b/src/Listeners/CacheClearSubscriber.php index 76886d6..8597073 100644 --- a/src/Listeners/CacheClearSubscriber.php +++ b/src/Listeners/CacheClearSubscriber.php @@ -7,9 +7,7 @@ class CacheClearSubscriber { - public function __construct() - { - } + public function __construct() {} public function handle(): void { diff --git a/src/Support/DomainAutoloader.php b/src/Support/DomainAutoloader.php index c203803..beae39e 100644 --- a/src/Support/DomainAutoloader.php +++ b/src/Support/DomainAutoloader.php @@ -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(); } @@ -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']); }); } @@ -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'; }); } @@ -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; diff --git a/src/ValueObjects/DomainNamespaces.php b/src/ValueObjects/DomainNamespaces.php index 3f1d9d9..44b8382 100644 --- a/src/ValueObjects/DomainNamespaces.php +++ b/src/ValueObjects/DomainNamespaces.php @@ -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 { diff --git a/src/ValueObjects/DomainObject.php b/src/ValueObjects/DomainObject.php index 2f1d2da..7744a89 100644 --- a/src/ValueObjects/DomainObject.php +++ b/src/ValueObjects/DomainObject.php @@ -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 { diff --git a/src/ValueObjects/DomainObjectNamespace.php b/src/ValueObjects/DomainObjectNamespace.php index 23c5240..bcb5ea4 100644 --- a/src/ValueObjects/DomainObjectNamespace.php +++ b/src/ValueObjects/DomainObjectNamespace.php @@ -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 { diff --git a/tests/Autoload/CommandTest.php b/tests/Autoload/CommandTest.php index 6fe1bf0..57650e7 100644 --- a/tests/Autoload/CommandTest.php +++ b/tests/Autoload/CommandTest.php @@ -18,7 +18,7 @@ $this->setupTestApplication(); $this->afterApplicationCreated(function () { - (new DomainAutoloader())->autoload(); + (new DomainAutoloader)->autoload(); }); }); @@ -35,7 +35,7 @@ $this->setupTestApplication(); $this->afterApplicationCreated(function () { - (new DomainAutoloader())->autoload(); + (new DomainAutoloader)->autoload(); }); }); @@ -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 @@ -94,7 +94,7 @@ DomainCache::clear(); $this->afterApplicationCreated(function () { - (new DomainAutoloader())->autoload(); + (new DomainAutoloader)->autoload(); }); $this->artisan('invoice:deliver')->assertSuccessful(); diff --git a/tests/Autoload/FactoryTest.php b/tests/Autoload/FactoryTest.php index 26f366c..f496b38 100644 --- a/tests/Autoload/FactoryTest.php +++ b/tests/Autoload/FactoryTest.php @@ -15,7 +15,7 @@ Config::set('ddd.autoload.factories', true); $this->afterApplicationCreated(function () { - (new DomainAutoloader())->autoload(); + (new DomainAutoloader)->autoload(); }); }); @@ -52,7 +52,7 @@ Config::set('ddd.autoload.factories', false); $this->afterApplicationCreated(function () { - (new DomainAutoloader())->autoload(); + (new DomainAutoloader)->autoload(); }); }); diff --git a/tests/Autoload/PolicyTest.php b/tests/Autoload/PolicyTest.php index 5a4212b..160117c 100644 --- a/tests/Autoload/PolicyTest.php +++ b/tests/Autoload/PolicyTest.php @@ -11,7 +11,7 @@ Config::set('ddd.autoload.factories', true); $this->afterApplicationCreated(function () { - (new DomainAutoloader())->autoload(); + (new DomainAutoloader)->autoload(); }); }); diff --git a/tests/Autoload/ProviderTest.php b/tests/Autoload/ProviderTest.php index 7e3e775..6316e54 100644 --- a/tests/Autoload/ProviderTest.php +++ b/tests/Autoload/ProviderTest.php @@ -18,7 +18,7 @@ ]); $this->afterApplicationCreated(function () { - (new DomainAutoloader())->autoload(); + (new DomainAutoloader)->autoload(); }); }); @@ -34,7 +34,7 @@ ]); $this->afterApplicationCreated(function () { - (new DomainAutoloader())->autoload(); + (new DomainAutoloader)->autoload(); }); }); @@ -57,7 +57,7 @@ DomainCache::set('domain-providers', []); $this->afterApplicationCreated(function () { - (new DomainAutoloader())->autoload(); + (new DomainAutoloader)->autoload(); }); expect(fn () => app('invoicing'))->toThrow(Exception::class); @@ -68,7 +68,7 @@ DomainCache::clear(); $this->afterApplicationCreated(function () { - (new DomainAutoloader())->autoload(); + (new DomainAutoloader)->autoload(); }); expect(app('invoicing'))->toEqual('invoicing-singleton'); diff --git a/tests/Support/AutoloaderTest.php b/tests/Support/AutoloaderTest.php index 6b7edf9..aec470b 100644 --- a/tests/Support/AutoloaderTest.php +++ b/tests/Support/AutoloaderTest.php @@ -7,7 +7,7 @@ }); it('can run', function () { - $autoloader = new DomainAutoloader(); + $autoloader = new DomainAutoloader; $autoloader->autoload(); })->throwsNoExceptions(); diff --git a/tests/TestCase.php b/tests/TestCase.php index ef9b57e..05348a2 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -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()