diff --git a/app-modules/database-migration/src/Commands/MigrateDatabaseCommand.php b/app-modules/database-migration/src/Commands/MigrateDatabaseCommand.php index f0da1118..128153a4 100644 --- a/app-modules/database-migration/src/Commands/MigrateDatabaseCommand.php +++ b/app-modules/database-migration/src/Commands/MigrateDatabaseCommand.php @@ -74,7 +74,7 @@ public function handle( $this->info('🔄 Migrating table: '.$table); if (! $isDryRun) { - $migrationService->migrateTable($table, $chunkSize, function (string $processed, $total): void { + $migrationService->migrateTable($table, $chunkSize, function (string $processed, int $total): void { $this->line(sprintf(' 📊 Processed %s/%s records', $processed, $total)); }); } else { diff --git a/app-modules/database-migration/src/Services/DatabaseMigrationService.php b/app-modules/database-migration/src/Services/DatabaseMigrationService.php index 62bb14ae..a02e3993 100644 --- a/app-modules/database-migration/src/Services/DatabaseMigrationService.php +++ b/app-modules/database-migration/src/Services/DatabaseMigrationService.php @@ -22,21 +22,17 @@ class DatabaseMigrationService */ public function getSourceTables(): array { - $tables = DB::connection($this->sourceConnection) - ->select('SHOW TABLES'); + $tables = DB::connection($this->sourceConnection)->select('SHOW TABLES'); $tableColumn = 'Tables_in_'.DB::connection($this->sourceConnection)->getDatabaseName(); return collect($tables) ->pluck($tableColumn) - ->reject(fn ($table): bool => in_array($table, $this->getExcludedTables())) + ->reject(fn (string $table): bool => in_array($table, $this->getExcludedTables())) ->values() ->toArray(); } - /** - * Get the number of records in a table - */ public function getTableRecordCount(string $table): int { return DB::connection($this->sourceConnection) @@ -73,7 +69,7 @@ public function migrateTable(string $table, int $chunkSize = 1000, ?callable $pr $totalRecords, $progressCallback ): void { - $data = $records->map(fn ($record): array => $this->transformRecord((array) $record))->all(); + $data = $records->map(fn (object $record): array => $this->transformRecord((array) $record))->all(); DB::connection($this->targetConnection) ->table($table) @@ -170,8 +166,7 @@ private function getExcludedTables(): array private function hasIdColumn(string $table): bool { - return Schema::connection($this->sourceConnection) - ->hasColumn($table, 'id'); + return Schema::connection($this->sourceConnection)->hasColumn($table, 'id'); } /** diff --git a/app/Listeners/NotifyMentionedUsers.php b/app/Listeners/NotifyMentionedUsers.php index 4a7b0ec5..e89ace8e 100644 --- a/app/Listeners/NotifyMentionedUsers.php +++ b/app/Listeners/NotifyMentionedUsers.php @@ -14,6 +14,6 @@ public function handle(ReplyWasCreated $event): void { User::query()->whereIn('username', $event->reply->mentionedUsers()) ->get() - ->each(fn ($user) => $user->notify(new YouWereMentioned($event->reply))); + ->each(fn (User $user) => $user->notify(new YouWereMentioned($event->reply))); } } diff --git a/config/cache.php b/config/cache.php index 23e26457..4633bfd9 100644 --- a/config/cache.php +++ b/config/cache.php @@ -11,13 +11,13 @@ | Default Cache Store |-------------------------------------------------------------------------- | - | This option controls the default cache connection that gets used while - | using this caching library. This connection is used when another is - | not explicitly specified when executing a given caching function. + | This option controls the default cache store that will be used by the + | framework. This connection is utilized if another isn't explicitly + | specified when running a cache operation inside the application. | */ - 'default' => env('CACHE_DRIVER', 'file'), + 'default' => env('CACHE_STORE', 'database'), /* |-------------------------------------------------------------------------- @@ -28,17 +28,13 @@ | well as their drivers. You may even define multiple stores for the | same cache driver to group types of items stored in your caches. | - | Supported drivers: "apc", "array", "database", "file", - | "memcached", "redis", "dynamodb", "null" + | Supported drivers: "array", "database", "file", "memcached", + | "redis", "dynamodb", "octane", "null" | */ 'stores' => [ - 'apc' => [ - 'driver' => 'apc', - ], - 'array' => [ 'driver' => 'array', 'serialize' => false, @@ -46,14 +42,16 @@ 'database' => [ 'driver' => 'database', - 'table' => 'cache', - 'connection' => null, - 'lock_connection' => null, + 'connection' => env('DB_CACHE_CONNECTION'), + 'table' => env('DB_CACHE_TABLE', 'cache'), + 'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'), + 'lock_table' => env('DB_CACHE_LOCK_TABLE'), ], 'file' => [ 'driver' => 'file', 'path' => storage_path('framework/cache/data'), + 'lock_path' => storage_path('framework/cache/data'), ], 'memcached' => [ @@ -77,8 +75,8 @@ 'redis' => [ 'driver' => 'redis', - 'connection' => 'cache', - 'lock_connection' => 'default', + 'connection' => env('REDIS_CACHE_CONNECTION', 'cache'), + 'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'), ], 'dynamodb' => [ @@ -90,6 +88,10 @@ 'endpoint' => env('DYNAMODB_ENDPOINT'), ], + 'octane' => [ + 'driver' => 'octane', + ], + ], /* @@ -97,12 +99,12 @@ | Cache Key Prefix |-------------------------------------------------------------------------- | - | When utilizing a RAM based store such as APC or Memcached, there might - | be other applications utilizing the same cache. So, we'll specify a - | value to get prefixed to all our keys so we can avoid collisions. + | When utilizing the APC, database, memcached, Redis, and DynamoDB cache + | stores, there might be other applications using the same cache. For + | that reason, you may prefix every cache key to avoid collisions. | */ - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), + 'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel'), '_').'_cache_'), ]; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index ae15009a..33daf626 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1458,12 +1458,6 @@ parameters: count: 1 path: config/app.php - - - rawMessage: 'Parameter #1 $title of static method Illuminate\Support\Str::slug() expects string, bool|string given.' - identifier: argument.type - count: 1 - path: config/cache.php - - rawMessage: 'Parameter #1 $title of static method Illuminate\Support\Str::slug() expects string, bool|string given.' identifier: argument.type diff --git a/phpunit.ci.xml b/phpunit.ci.xml deleted file mode 100644 index 15734cb1..00000000 --- a/phpunit.ci.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - ./tests/Feature - - - ./app-modules/*/tests - - - - - app - app-modules - - - app-modules/*/resources - app-modules/*/database - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/phpunit.xml b/phpunit.xml index 86c3c18e..3e4e3b6a 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,36 +1,45 @@ - - - - ./tests/Feature - - - ./app-modules/*/tests - - - - - - - - - - - - - - - - - - - - - - - - - ./app - - + + + + ./tests/Feature + + + ./app-modules/*/tests + + + + + app + app-modules + + + + + + + + + + + + + + + + + + + + + + + +