From d03cc38be33c8193c1ecfd90203cf5fa966d2bc3 Mon Sep 17 00:00:00 2001 From: Arman <407448+armanist@users.noreply.github.com> Date: Wed, 6 May 2026 18:40:47 +0400 Subject: [PATCH 1/2] [#188] Align project code with framework renames --- migrations/create_table_comments_1698145440.php | 4 ++-- migrations/create_table_posts_1669639752.php | 4 ++-- migrations/create_table_users_1669639740.php | 4 ++-- shared/Commands/CommentCreateCommand.php | 4 ++-- shared/Commands/CommentDeleteCommand.php | 4 ++-- shared/Commands/DemoCommand.php | 7 +++---- shared/Commands/PostCreateCommand.php | 4 ++-- shared/Commands/PostDeleteCommand.php | 4 ++-- shared/Commands/PostShowCommand.php | 4 ++-- shared/Commands/PostUpdateCommand.php | 4 ++-- shared/Commands/UserCreateCommand.php | 4 ++-- shared/Commands/UserDeleteCommand.php | 4 ++-- shared/Commands/UserShowCommand.php | 4 ++-- shared/Services/AuthService.php | 4 ++-- shared/Services/CommentService.php | 4 ++-- shared/Services/PostService.php | 4 ++-- tests/Feature/AppTestCase.php | 7 ++----- tests/Feature/modules/Api/AuthControllerTest.php | 4 +--- tests/Feature/modules/Api/CommentControllerTest.php | 4 +--- tests/Feature/modules/Api/PostControllerTest.php | 2 -- tests/Feature/modules/Api/PostManagementControllerTest.php | 2 -- tests/Helpers/functions.php | 3 +-- tests/bootstrap.php | 4 ++-- 23 files changed, 40 insertions(+), 53 deletions(-) diff --git a/migrations/create_table_comments_1698145440.php b/migrations/create_table_comments_1698145440.php index dad02ed..46b00ae 100644 --- a/migrations/create_table_comments_1698145440.php +++ b/migrations/create_table_comments_1698145440.php @@ -1,9 +1,9 @@ getConfigs()['driver']) { + switch (db()->getConfigs()['driver']) { case 'mysql': $this->runCommandInternally(self::COMMANDS['migrate'], ['direction' => 'down']); $this->runCommandInternally(self::COMMANDS['migrate'], ['direction' => 'up']); diff --git a/shared/Commands/PostCreateCommand.php b/shared/Commands/PostCreateCommand.php index 9192461..efbcecd 100644 --- a/shared/Commands/PostCreateCommand.php +++ b/shared/Commands/PostCreateCommand.php @@ -20,7 +20,7 @@ use Quantum\App\Exceptions\BaseException; use Quantum\Di\Exceptions\DiException; use Shared\Services\PostService; -use Quantum\Console\QtCommand; +use Quantum\Console\CliCommand; use Quantum\Validation\Rule; use Shared\DTOs\PostDTO; use ReflectionException; @@ -29,7 +29,7 @@ * Class PostCreateCommand * @package Shared\Commands */ -class PostCreateCommand extends QtCommand +class PostCreateCommand extends CliCommand { use CommandValidationTrait; diff --git a/shared/Commands/PostDeleteCommand.php b/shared/Commands/PostDeleteCommand.php index 0db76d3..51d4a03 100644 --- a/shared/Commands/PostDeleteCommand.php +++ b/shared/Commands/PostDeleteCommand.php @@ -20,14 +20,14 @@ use Quantum\App\Exceptions\BaseException; use Quantum\Di\Exceptions\DiException; use Shared\Services\PostService; -use Quantum\Console\QtCommand; +use Quantum\Console\CliCommand; use ReflectionException; /** * Class PostDeleteCommand * @package Shared\Commands */ -class PostDeleteCommand extends QtCommand +class PostDeleteCommand extends CliCommand { /** * Command name diff --git a/shared/Commands/PostShowCommand.php b/shared/Commands/PostShowCommand.php index b4b7c74..c1c2ede 100644 --- a/shared/Commands/PostShowCommand.php +++ b/shared/Commands/PostShowCommand.php @@ -22,14 +22,14 @@ use Quantum\Di\Exceptions\DiException; use Quantum\Model\ModelCollection; use Shared\Services\PostService; -use Quantum\Console\QtCommand; +use Quantum\Console\CliCommand; use ReflectionException; /** * Class PostShowCommand * @package Shared\Commands */ -class PostShowCommand extends QtCommand +class PostShowCommand extends CliCommand { /** * Posts per page diff --git a/shared/Commands/PostUpdateCommand.php b/shared/Commands/PostUpdateCommand.php index 8fdffeb..a1e6897 100644 --- a/shared/Commands/PostUpdateCommand.php +++ b/shared/Commands/PostUpdateCommand.php @@ -20,7 +20,7 @@ use Quantum\App\Exceptions\BaseException; use Quantum\Di\Exceptions\DiException; use Shared\Services\PostService; -use Quantum\Console\QtCommand; +use Quantum\Console\CliCommand; use Quantum\Validation\Rule; use Shared\DTOs\PostDTO; use ReflectionException; @@ -29,7 +29,7 @@ * Class PostUpdateCommand * @package Shared\Commands */ -class PostUpdateCommand extends QtCommand +class PostUpdateCommand extends CliCommand { use CommandValidationTrait; diff --git a/shared/Commands/UserCreateCommand.php b/shared/Commands/UserCreateCommand.php index 41c4e85..529bfde 100644 --- a/shared/Commands/UserCreateCommand.php +++ b/shared/Commands/UserCreateCommand.php @@ -21,7 +21,7 @@ use Quantum\Di\Exceptions\DiException; use Quantum\Validation\Validator; use Shared\Services\AuthService; -use Quantum\Console\QtCommand; +use Quantum\Console\CliCommand; use Quantum\Validation\Rule; use Quantum\Hasher\Hasher; use Shared\DTOs\UserDTO; @@ -32,7 +32,7 @@ * Class UserCreateCommand * @package Shared\Commands */ -class UserCreateCommand extends QtCommand +class UserCreateCommand extends CliCommand { use CommandValidationTrait; diff --git a/shared/Commands/UserDeleteCommand.php b/shared/Commands/UserDeleteCommand.php index d9336f0..93afd90 100644 --- a/shared/Commands/UserDeleteCommand.php +++ b/shared/Commands/UserDeleteCommand.php @@ -20,14 +20,14 @@ use Quantum\App\Exceptions\BaseException; use Quantum\Di\Exceptions\DiException; use Shared\Services\AuthService; -use Quantum\Console\QtCommand; +use Quantum\Console\CliCommand; use ReflectionException; /** * Class PostDeleteCommand * @package Shared\Commands */ -class UserDeleteCommand extends QtCommand +class UserDeleteCommand extends CliCommand { /** * Command name diff --git a/shared/Commands/UserShowCommand.php b/shared/Commands/UserShowCommand.php index 72e01d4..21ff1ed 100644 --- a/shared/Commands/UserShowCommand.php +++ b/shared/Commands/UserShowCommand.php @@ -22,14 +22,14 @@ use Quantum\Di\Exceptions\DiException; use Quantum\Model\ModelCollection; use Shared\Services\AuthService; -use Quantum\Console\QtCommand; +use Quantum\Console\CliCommand; use ReflectionException; /** * Class UserShowCommand * @package Shared\Commands */ -class UserShowCommand extends QtCommand +class UserShowCommand extends CliCommand { /** * Command name diff --git a/shared/Services/AuthService.php b/shared/Services/AuthService.php index cc5d9a0..b61b509 100644 --- a/shared/Services/AuthService.php +++ b/shared/Services/AuthService.php @@ -23,7 +23,7 @@ use Quantum\Di\Exceptions\DiException; use Quantum\Auth\User as AuthUser; use Quantum\Model\ModelCollection; -use Quantum\Service\QtService; +use Quantum\Service\Service; use ReflectionException; use Shared\Models\User; @@ -31,7 +31,7 @@ * Class AuthService * @package Shared\Services */ -class AuthService extends QtService implements AuthServiceInterface +class AuthService extends Service implements AuthServiceInterface { /** * @var User diff --git a/shared/Services/CommentService.php b/shared/Services/CommentService.php index 0aaffc3..89067b1 100644 --- a/shared/Services/CommentService.php +++ b/shared/Services/CommentService.php @@ -20,7 +20,7 @@ use Shared\Transformers\CommentTransformer; use Quantum\App\Exceptions\BaseException; use Quantum\Model\ModelCollection; -use Quantum\Service\QtService; +use Quantum\Service\Service; use Shared\DTOs\CommentDTO; use Shared\Models\Comment; use Shared\Models\User; @@ -29,7 +29,7 @@ * Class CommentService * @package Shared\Services */ -class CommentService extends QtService +class CommentService extends Service { /** * @var Comment diff --git a/shared/Services/PostService.php b/shared/Services/PostService.php index 9ec6375..d2d331b 100644 --- a/shared/Services/PostService.php +++ b/shared/Services/PostService.php @@ -28,7 +28,7 @@ use Quantum\Model\ModelCollection; use Quantum\Storage\UploadedFile; use Gumlet\ImageResizeException; -use Quantum\Service\QtService; +use Quantum\Service\Service; use Quantum\Model\DbModel; use ReflectionException; use Shared\DTOs\PostDTO; @@ -39,7 +39,7 @@ * Class PostService * @package Shared\Services */ -class PostService extends QtService +class PostService extends Service { /** * @var DbModel diff --git a/tests/Feature/AppTestCase.php b/tests/Feature/AppTestCase.php index 56e9856..2285e1e 100644 --- a/tests/Feature/AppTestCase.php +++ b/tests/Feature/AppTestCase.php @@ -5,9 +5,7 @@ use PHPUnit\Framework\TestCase; use Quantum\App\Enums\AppType; use Quantum\Http\Response; -use Quantum\Http\Request; use Quantum\App\App; -use Quantum\Di\Di; class AppTestCase extends TestCase { @@ -42,10 +40,9 @@ public function request( array $headers = [], array $files = [] ): Response { - Di::resetContainer(); - Request::create($method, $url, $params, $headers, $files); + request()->create($method, $url, $params, $headers, $files); self::$app->start(); - return new Response(); + return response(); } protected function signInAndGetTokens(): array diff --git a/tests/Feature/modules/Api/AuthControllerTest.php b/tests/Feature/modules/Api/AuthControllerTest.php index f52f79b..d8ab1de 100644 --- a/tests/Feature/modules/Api/AuthControllerTest.php +++ b/tests/Feature/modules/Api/AuthControllerTest.php @@ -17,9 +17,7 @@ class AuthControllerTest extends AppTestCase public function setUp(): void { parent::setUp(); - - Request::flush(); - Response::flush(); + response()->flush(); $this->faker = Factory::create(); } diff --git a/tests/Feature/modules/Api/CommentControllerTest.php b/tests/Feature/modules/Api/CommentControllerTest.php index 5422869..cd0324a 100644 --- a/tests/Feature/modules/Api/CommentControllerTest.php +++ b/tests/Feature/modules/Api/CommentControllerTest.php @@ -25,9 +25,7 @@ public function setUp(): void $postData = $response->get('data'); $this->post = $postData[0]; - - Request::flush(); - Response::flush(); + response()->flush(); } public function tearDown(): void diff --git a/tests/Feature/modules/Api/PostControllerTest.php b/tests/Feature/modules/Api/PostControllerTest.php index 8d84fad..9312f0d 100644 --- a/tests/Feature/modules/Api/PostControllerTest.php +++ b/tests/Feature/modules/Api/PostControllerTest.php @@ -12,8 +12,6 @@ class PostControllerTest extends AppTestCase public function setUp(): void { parent::setUp(); - - Request::flush(); } public function tearDown(): void diff --git a/tests/Feature/modules/Api/PostManagementControllerTest.php b/tests/Feature/modules/Api/PostManagementControllerTest.php index fc115b9..8208b2f 100644 --- a/tests/Feature/modules/Api/PostManagementControllerTest.php +++ b/tests/Feature/modules/Api/PostManagementControllerTest.php @@ -16,8 +16,6 @@ public function setUp(): void parent::setUp(); $this->tokens = $this->signInAndGetTokens(); - - Request::flush(); } public function tearDown(): void diff --git a/tests/Helpers/functions.php b/tests/Helpers/functions.php index d4618a1..0755c85 100644 --- a/tests/Helpers/functions.php +++ b/tests/Helpers/functions.php @@ -13,7 +13,6 @@ use Quantum\Hasher\Hasher; use Shared\DTOs\PostDTO; use Quantum\Router\Route; -use Quantum\Http\Request; use Shared\Models\User; use Quantum\App\App; use Faker\Factory; @@ -55,7 +54,7 @@ function createModule(string $moduleName, string $template, bool $withAssets = f }); $route->module($moduleName); $matchedRoute = new MatchedRoute($route, []); - Request::setMatchedRoute($matchedRoute); + request()->setMatchedRoute($matchedRoute); ob_end_clean(); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 14705b8..35e2172 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -29,7 +29,7 @@ createPostComments($user, $posts); register_shutdown_function(function () { - removeEnvFile(); - removeModule(); dbCleanUp(); + removeModule(); + removeEnvFile(); }); From 762e2522b15168f1fffbdce4a3cdefd48a68bbf7 Mon Sep 17 00:00:00 2001 From: Arman <407448+armanist@users.noreply.github.com> Date: Wed, 6 May 2026 19:03:26 +0400 Subject: [PATCH 2/2] [#188] Codding style and doc block fixes --- shared/Commands/DemoCommand.php | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/shared/Commands/DemoCommand.php b/shared/Commands/DemoCommand.php index 1d408cd..ef75d08 100644 --- a/shared/Commands/DemoCommand.php +++ b/shared/Commands/DemoCommand.php @@ -36,7 +36,6 @@ use RuntimeException; use Faker\Generator; use ErrorException; -use Quantum\Di\Di; use Faker\Factory; /** @@ -204,8 +203,6 @@ private function getSteps(): array /** * Initializes a progress bar. - * @param int $steps - * @return ProgressBar */ private function initProgressBar(int $steps): ProgressBar { @@ -220,9 +217,6 @@ private function initProgressBar(int $steps): ProgressBar /** * Creates module - * @param string $moduleName - * @param string $template - * @param bool $withAssets */ private function createModule(string $moduleName, string $template, bool $withAssets): void { @@ -242,7 +236,6 @@ private function createModule(string $moduleName, string $template, bool $withAs /** * Generate demo users. - * @return array * @throws BaseException * @throws ConfigException * @throws DiException @@ -264,8 +257,6 @@ private function generateUsers(): array /** * Generate demo posts for each user. - * @param array $users - * @return array * @throws BaseException * @throws ConfigException * @throws DiException @@ -291,9 +282,6 @@ private function generatePosts(array $users): array /** * Generate demo comments for each post. - * @param array $users - * @param array $posts - * @return void * @throws ExceptionInterface */ private function generateComments(array $users, array $posts): void @@ -313,7 +301,6 @@ private function generateComments(array $users, array $posts): void /** * Generates data for user - * @return array * @throws BaseException * @throws ConfigException * @throws DiException @@ -347,8 +334,6 @@ private function generateUserData(): array /** * Generates data for post - * @param array $user - * @return array * @throws BaseException * @throws ConfigException * @throws DiException @@ -378,9 +363,6 @@ private function generatePostData(array $user): array /** * Get random user for comment except post owner - * @param array $users - * @param string $excludeUuid - * @return array */ private function getRandomUserExcept(array $users, string $excludeUuid): array { @@ -403,7 +385,6 @@ private function updateProgress(ProgressBar $progress, string $message): void /** * Rebuilds the database - * @return void * @throws ExceptionInterface */ private function rebuildDatabase(): void @@ -444,7 +425,6 @@ private function removeUploads(): void /** * Cleans the uploads and resets the database. - * @return void * @throws BaseException * @throws ConfigException * @throws DiException @@ -458,8 +438,6 @@ private function resetDatabase(): void } /** - * @param string $commandName - * @param array $arguments * @throws ExceptionInterface */ private function runCommandInternally(string $commandName, array $arguments = []): void @@ -469,8 +447,7 @@ private function runCommandInternally(string $commandName, array $arguments = [] } /** - * @param string $commandName - * @param array $arguments + * Runs command externally */ private function runCommandExternally(string $commandName, array $arguments = []): void { @@ -480,8 +457,6 @@ private function runCommandExternally(string $commandName, array $arguments = [] /** * Runs separate process - * @param array $command - * @return void */ private function runExternalProcess(array $command): void { @@ -493,8 +468,6 @@ private function runExternalProcess(array $command): void /** * Builds command string - * @param string $commandName - * @param array $arguments * @return string[] */ private function buildCommand(string $commandName, array $arguments): array